Crontab and poweroff

All about firmwares for routers. Support for RouterTech firmwares is here too.
Post Reply
rospogrigio
Newbie
Newbie
Posts: 4
Joined: Sun Feb 01, 2009 11:53 am

Crontab and poweroff

Post by rospogrigio » Fri Apr 10, 2009 10:43 am

Hi guys, great site and great job with your 2.8 firmware.
I have a question: I have tried and succeeded in setting up a cron job at startup through this command:

Code: Select all

cronjob.sh "mycommand" "*/10" "*/1" "*" "*" "*" "RT_cmd_1" 
The job is set up correctly even after a reboot, but if I switch off and on the router then the job vanishes. Is there a way to make it persistent also after poweroff? Should I program the flash to achieve this? How risky is this procedure? And if I decide to take the risk, where can I find instructions to do this?

Thank you in advance, bye
rospogrigio

Edit: my router is a Roper Flynet ADSL2/2+ wireless, if this info can be of any help...
hyperair
Experienced
Experienced
Posts: 202
Joined: Sun Oct 14, 2007 4:04 pm

Post by hyperair » Fri Apr 10, 2009 11:18 am

How about this:

Code: Select all

setenv RT_cmd_1 'cronjob.sh "mycommand" "*/10" "*/1" "*" "*" "*" "RT_cmd_1" '
rospogrigio
Newbie
Newbie
Posts: 4
Joined: Sun Feb 01, 2009 11:53 am

Post by rospogrigio » Fri Apr 10, 2009 11:25 am

hyperair wrote:How about this:

Code: Select all

setenv RT_cmd_1 'cronjob.sh "mycommand" "*/10" "*/1" "*" "*" "*" "RT_cmd_1" '
Wow, thx for the quick reply. I am at work now so I will try it later when I get back home. So it should be possible without writing the flash? I also found a script called "saveall.sh" which sends some commands to cm_cli : will it do the job? Anyway, I'll try everything later on...
hyperair
Experienced
Experienced
Posts: 202
Joined: Sun Oct 14, 2007 4:04 pm

Post by hyperair » Fri Apr 10, 2009 12:48 pm

Actually setenv sets the bootloader environment variables, and this is always persistent. saveall.sh is for stuff like your wireless configuration, DSL configuration, and whatnot.

RT_cmd_1 is basically one of the environment variables that the Routertech firmware checks when starting up, and runs any commands stored in it. Hence, if you stick a command there, it will be run when the firmware loads.
rospogrigio
Newbie
Newbie
Posts: 4
Joined: Sun Feb 01, 2009 11:53 am

Post by rospogrigio » Fri Apr 10, 2009 12:59 pm

hyperair wrote:RT_cmd_1 is basically one of the environment variables that the Routertech firmware checks when starting up, and runs any commands stored in it. Hence, if you stick a command there, it will be run when the firmware loads.
I see. Is there any difference between setting the command on autoexec.sh rather than RT_cmd_1 ? Because actually my first try was using autoexec.sh and it was not persistent. I'll see if RT_cmd_1 works...
rospogrigio
Newbie
Newbie
Posts: 4
Joined: Sun Feb 01, 2009 11:53 am

Post by rospogrigio » Fri Apr 10, 2009 2:04 pm

OK, it seems to be persistent! (don't know the problem with autoexec.sh though) Thanks everybody for the help!
hyperair
Experienced
Experienced
Posts: 202
Joined: Sun Oct 14, 2007 4:04 pm

Post by hyperair » Fri Apr 10, 2009 2:39 pm

Hmm I'm not sure really. I thought it was the same. I'd experiment with my router, but it's a few hundred miles away.
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Fri Apr 10, 2009 2:58 pm

You shouldn't need the leading RT_cmd_1 for this because the router will notice the "sh" in the cronjob.sh entry.

autoexec.sh waits until the WAN is connected before running - useful for things that need an external Internet connection.

RT_cmd_x run straight after the main router initialization code, RT_init_x ones run before.

When multiple commands exist in the environment they will be executed in alphabetical order, not necessarily the order they appear in the env listing.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Crontab and poweroff

Post by thechief » Fri Apr 10, 2009 3:22 pm

rospogrigio wrote:Hi guys, great site and great job with your 2.8 firmware.
I have a question: I have tried and succeeded in setting up a cron job at startup through this command:

Code: Select all

cronjob.sh "mycommand" "*/10" "*/1" "*" "*" "*" "RT_cmd_1" 
The job is set up correctly even after a reboot, but if I switch off and on the router then the job vanishes. Is there a way to make it persistent also after poweroff? Should I program the flash to achieve this? How risky is this procedure? And if I decide to take the risk, where can I find instructions to do this?

Thank you in advance, bye
rospogrigio

Edit: my router is a Roper Flynet ADSL2/2+ wireless, if this info can be of any help...
The syntax you are using is for is cronjob-env.sh. Change cronjob.sh to cronjob-env.sh in that command, and you will have all you want.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Post Reply