What's new

Scheduling rebooting??

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

tsunami2311

Senior Member
IS this possible if so if so can i get pointed in the correct direction as I would like to make router reboot once week at certian day and time, if at all possible
 
IS this possible if so if so can i get pointed in the correct direction as I would like to make router reboot once week at certian day and time, if at all possible
Hi,

Yes, this is possible, allthough it's really not necessary! :)

The command would look like this:
/usr/sbin/cru a reboot "0 6 * * 0 reboot"
Which means: Reboot every Sunday at 6:00am.

To have the cron job it back on a reboot you might want to add this command into the services-start user script in the /jffs/scripts folder.

With kind regards
Joe :cool:
 
Where am I supposed to put this or even set it up? cause I read the wiki and it made very little sense, The one thing I liked about DD-wrt firmware was i could scheduled reboots rather easy. While it may not be need I would still like to say REboot the router every tuesday at 6am or once week at 6am.

Stupid question but can logging be turn off? Like Traffic logging I usual just leave system log on most the routers i had. Also "ram" location for logs is actual ram and not flash ram? cause I moved all the logs on to usb stick cause I was unsure dont wana kill router cause of logs seeing this most i ever spent on router
 
Last edited:
To have the cron job it back on a reboot you might want to add this command into the services-start user script in the /jffs/scripts folder.
You should read the section about user scripts in Merlin's Wiki... :rolleyes:

As your router runs a kind of linux (like DD-WRT does as well) you should make yourself familiar with Linux scripting!

Regarding Logging: Not sure what you ask here. :confused:

Logs are created in RAM, but reach only a certain size which is defined in the startup of the logging service.
The default setting is:
Code:
350 admin     1416 S    syslogd -m 0 -S -O /tmp/syslog.log -s 512 -l 7
This means that after 512 KByte the logging will start overwriting (or better deleting) the old entries.

With kind regards
Joe :cool:
 
You should read the section about user scripts in Merlin's Wiki... :rolleyes:

As your router runs a kind of linux (like DD-WRT does as well) you should make yourself familiar with Linux scripting!

Regarding Logging: Not sure what you ask here. :confused:

Logs are created in RAM, but reach only a certain size which is defined in the startup of the logging service.
The default setting is:
Code:
350 admin     1416 S    syslogd -m 0 -S -O /tmp/syslog.log -s 512 -l 7
This means that after 512 KByte the logging will start overwriting (or better deleting) the old entries.

With kind regards
Joe :cool:

I read that link it it made no sense to meit being linux would be why I know nothing about that never had reason to learn it either I get around the schedule rebooting once i fiqure that out I Not big issue i guess seeing my old DGND 3330 v2 netgear never was reboot unless i did which was almost never.

You mention the default for the log is is the above command, Which mean after 512 KByte its overriding anyway. So default settings for logs means i dont have to worry about it eating up more and more ram cause its overriding after 512 KBytes correct?
 
Last edited:
No need to worry about logging indeed. It's in RAM so it won't wear your flash, and the log gets rotated after 512 KB. The router keeps a maximum of two logs, so you will never use more than 1 MB of RAM.

So far I always refused to implement a webui interface to schedule reboots because if I do, then someone will ask to make the scheduling more flexible to support two different scheduled reboots. Then someone else will ask for multiple reboot schedules. Then, someone else will ask for the feature allowing him to run a script before doing the reboot. And so on... Since I want to avoid feature bloat in my firmware, I decided to leave it to users to do it through scripting. I'm sure someone will be able to guide you through the details on how to do it - it's simpler than you might think. :)
 
Actually, here's an easy way for you to create that schedule.

1) Enable JFFS + Format JFFS + Telnet on the Administration -> System page, then reboot.
2) Download the software called Putty (should be easy to find on Google)
3) Using Putty, connect using the Telnet protocol to your router's IP (probably 192.168.1.1) Username and password are the same as for the webui.
4) Type the following, one line at a time:

Code:
cat << EOF > /jffs/scripts/services-start
#!/bin/sh
/usr/sbin/cru a ScheduledReboot "0 6 * * * reboot"
EOF

Set 0 (minutes) and 6 (hour) to the desired reboot time, for a daily reboot. Those arguments are:

"min hour day month week command"

After this you will be back to the prompt. Now run this:

Code:
chmod a+rx /jffs/scripts/services-start
/jffs/scripts/services-start

That will set up the cron job. Every time you reboot the router, the reboot task will be re-established.

To remove the task:

Code:
rm /jffs/scripts/services-start
cru d ScheduledReboot
 
Last edited:
Actually, here's an easy way for you to create that schedule.

1) Enable JFFS + Format JFFS + Telnet on the Administration -> System page, then reboot.
2) Download the software called Putty (should be easy to find on Google)
3) Using Putty, connect using the Telnet protocol to your router's IP (probably 192.168.1.1) Username and password are the same as for the webui.
4) Type the following, one line at a time:

Code:
cat << EOF > /jffs/scripts/services-start
#!/bin/sh
/usr/sbin/cru a ScheduledReboot "0 6 * * * reboot"
EOF

Set 0 (minutes) and 6 (hour) to the desired reboot time, for a daily reboot. Those arguments are:

"min hour day month week command"

After this you will be back to the prompt. Now run this:

Code:
chmod a+rx /jffs/scripts/services-start
/jffs/scripts/services-start

That will set up the cron job. Every time you reboot the router, the reboot task will be re-established.

To remove the task:

Code:
rm /jffs/scripts/services-start
cru d ScheduledReboot

So if I want every tuesday of ever week at 6am it would be

/usr/sbin/cru a ScheduledReboot "0 6 2 * 1 reboot ?

And once month would be on tuesday at 6am
/usr/sbin/cru a ScheduledReboot "0 6 2 1 * reboot ?
 
Last edited:
So if I want every tuesday of ever week at 6am it would be

/usr/sbin/cru a ScheduledReboot "0 6 2 * 1 reboot ?

"0 6 2 * *"

You want Tuesday, of any month (*) and any week (*).

And once month would be on tuesday at 6am
/usr/sbin/cru a ScheduledReboot "0 6 2 1 * reboot ?


"0 6 2 * 1"

Would be the Tuesday, of any month (*), the first week (1).

That's at least the theory. The "week" parameter isn't a standard cron parameter AFAIK, might be specific to the crond build in Busybox I guess.
 
I thank you I will give it ago, but i thinking it might not be worth it at this point I will see in the coming weeks if I really need to have it do this rebooting
 
I thank you I will give it ago, but i thinking it might not be worth it at this point I will see in the coming weeks if I really need to have it do this rebooting

Reapeting myself: :)
Hi,

Yes, this is possible, allthough it's really not necessary! :)

With kind regards
Joe :cool:
 
Reapeting myself: :)


With kind regards
Joe :cool:

haha I know like said it just something i a custom to with the old wrt54gs with drtwrt i had on it, I never did it on my dgnd 3330v2 I just of the opinion of everything should be rebooted every now and then. Though I do thank both you for making it easier for me to under stand.

I just have 2 thing on the router I need to fiqure out and then I good
 
what cmd can I run to verify that a reboot is scheduled?

Hi,

To get a list of the scheduled activites you can use cru or crontab command via telnet als follows:
Code:
chief@ASUS_RT-N66U:/tmp/home/root# [B]cru l[/B]
 0 4 * * * /jffs/scripts/restart-wlan.sh #RestartWifi#
 0 20 * * * /jffs/scripts/ledsoff.sh #LEDsoff#
 0 8 * * * /jffs/scripts/ledson.sh #LEDson#
chief@ASUS_RT-N66U:/tmp/home/root# [B]crontab -l[/B]
 0 4 * * * /jffs/scripts/restart-wlan.sh #RestartWifi#
 0 20 * * * /jffs/scripts/ledsoff.sh #LEDsoff#
 0 8 * * * /jffs/scripts/ledson.sh #LEDson#

With kind regards
Joe :cool:
 
It's cool you can script the LEDs . . what's the command for on/off? I see the script name but I assume there's a command (like restart_wireless).

I can just add that to my services-start file . . (I already have the wifi restarting daily).
 
You know I don't really need this functionality. But I did it anyway. 'Cause it's bad butt.

Actually my router sits by my TV--so my excuse is I'm turning it off in the evening for TV purposes.

Thanks Merlin. This is pretty cool.
 
It's cool you can script the LEDs . . what's the command for on/off? I see the script name but I assume there's a command (like restart_wireless).

I can just add that to my services-start file . . (I already have the wifi restarting daily).
Hi,

Here are my scripts related to the LEDs on/off scheduling.

ledsoff.sh:
Code:
#!/bin/sh
/bin/nvram set led_disable=1
/sbin/service restart_leds
exit $?
ledson.sh:
Code:
#!/bin/sh
/bin/nvram set led_disable=0
/sbin/service restart_leds
exit $?
And the crontab entries are set in the services-start script to let the LEDs go off at 8:00pm and back on at 8:00am:
Code:
#!/bin/sh
/usr/bin/logger -t START_$(basename $0) "started [$@]"
SCRLOG=/tmp/$(basename $0).log
touch $SCRLOG
echo "START_$(basename $0) started [$@]" >> $SCRLOG
/usr/sbin/cru a RestartWifi " 0 4 * * * /jffs/scripts/restart-wlan.sh" >> $SCRLOG
wait
[B]/usr/sbin/cru a LEDsoff " 0 20 * * * /jffs/scripts/ledsoff.sh" >> $SCRLOG[/B]
wait
[B]/usr/sbin/cru a LEDson " 0 8 * * * /jffs/scripts/ledson.sh" >> $SCRLOG[/B]
wait
if [ "$?" -ne 0 ]
then
echo "Error in services-start execution! Script: $0" >> $SCRLOG
#exit $?
else
echo "Services-start execution OK. Script: $0" >> $SCRLOG
#exit 0
fi
/usr/bin/logger -t STOP_$(basename $0) "return code $?"
exit $?

With kind regards
Joe :cool:
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top