7141 questions

8568 answers

13830 comments

10608 members

0 votes
59 views 3 comments
by
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

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
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

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
Could you try entering everything into User Scripts field instead of rc.local file?

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

EB.