FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
338 views 3 comments
by anonymous
Hi,  

I am setting up a periodic reboot to reboot my RUT995 router but I would like it to reboot with a particular profile.

It there any way to set the profile when the unit is rebooted?

Thank You

Regards

1 Answer

0 votes
by anonymous

Hi,

The easiest way would be doing it through commands that are automatically executed when the router boots.

First of all you need to know how to and where to put the commands so they would be executed every time your routers starts:

There's a file in /etc directory named rc.local, there you will be able to put any commands and they will be executed once your router reboots.

To edit the file use WinSCP software or vi command in CLI: https://www.cs.colostate.edu/helpdocs/vi.html

Once you're editing the file, you will need these commands in it by the exact order:

tar -C / -xzf /etc/profiles/

/usr/sbin/profile.sh -u

uci set profiles.general.profile=[profile] 

(IMPORTANT, you need to enter your profile name here, instead of [profile], use 'yourprofilename')

uci commit

/sbin/luci-reload

And that's it, save rc.local file and try to restart your router.

P.S, you could use User Scripts page to insert commands too without editing rc.local and they will be executed on start, but you must fill out User Scripts for both profiles if you want them to switch between every time you restart the device.

https://wiki.teltonika-networks.com/view/RUT955_User_Scripts

EB.

by anonymous
Hi,

Tried to implement the commands above.

If I run script the tar command is returning

invalid magic

short read

and uci  returns Entry not found

Have check all the commands in the file Is there something I missed

Thank You

Regards
by anonymous

Hi,

I edited the rc.local file with WinSCP

I changed the tar -C / -xzf /etc/profiles/ and add the specific tar file for the profile that is found in the /etc/profiles folder

tar -C / -xzf /etc/profiles/4G_connection_1614744036.tar.gz

I then had to make it executable

chown root /etc/rc.local

chmod 755 /etc/rc.local

and check its executable

ls -l /etc/rc.local

-rwxr-xr-x 1 root root 419 2010-08-27 11:26 /etc/rc.local

Then run the script 

Verify everything works fine:

/etc/rc.local start 

which changes the profile back to 4G_connection.

So I then wanted to test it again, logged in to the router and went to system>profiles and change the profile so that it is not 4G_connection. The router reboots and the rc.local file is back to its default empty state without the lines that were added.

Is there a way to stop the file from being overwritten?

Thank You

Regards

by anonymous
Could you try entering everything into User Scripts field instead of rc.local file?

https://wiki.teltonika-networks.com/view/RUT955_User_Scripts

EB.