I am looking for a way to give the wrt an auto reboot each night , so lets say after 43200 sec the restart will follow.
Is there a way to do so?
(Last edited by jaba on 14 Jul 2005, 16:03)

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.
I am looking for a way to give the wrt an auto reboot each night , so lets say after 43200 sec the restart will follow.
Is there a way to do so?
(Last edited by jaba on 14 Jul 2005, 16:03)
Looking for a way to give the wrt an auto reboot each night , anyone ?
Juste use cron.
I thought so, but i am not formiliar with cron yet.
were do i find it, is it an ipkg that i need to install?
You don't have to install an ipkg-package.
I think you can create a cronjob in /etc/init.d/ for example.
But i'm not sure because before i used OpenWRT i created a cronjob in /tmp/cron.d/.
Sorry for my bad english.
jaba, this may be easier for you:
cat > /etc/init.d/S98reboottimer
#!/bin/ash
sleep 24h && reboot &
<Press Control-D>
chmod +x /etc/init.d/S98reboottimernext time you reboot this 24 hour timer will begin. The trick is to line it up with midnight using a similar command. If it is now 8pm, for example,
sleep 4h && reboot &This will cause the wrt to reboot in 4 hours, at 12 midnight. I'm not sure if the sleep command on the wrt takes strings like "1hr30m" but I know you can string sleeps together if you need to set it at a specific time:
sleep 2h && sleep 30m && reboot &hope this helps. Last time I tried to set up cron on a wrt I was unable to get it figured out, but my need wasn't really that big.
moj
For instance, you can create a file containing ::
* * */1 * * rebootin /etc/crontabs/root (where root is a file and not a directory)
and finally, start crond like that ::
crond -c /etc/crontabsOh, man - I wish it wasn't as easy as you just showed it to be. Thank you!!
Great answers, i will give it a try to the both off them.
Thanks.
I have installed your idea in all off the wrt54 I use, it works more then excellent.
Thanks for the help.
jaba, this may be easier for you:
cat > /etc/init.d/S98reboottimer #!/bin/ash sleep 24h && reboot & <Press Control-D> chmod +x /etc/init.d/S98reboottimernext time you reboot this 24 hour timer will begin. The trick is to line it up with midnight using a similar command. If it is now 8pm, for example,
sleep 4h && reboot &This will cause the wrt to reboot in 4 hours, at 12 midnight. I'm not sure if the sleep command on the wrt takes strings like "1hr30m" but I know you can string sleeps together if you need to set it at a specific time:
sleep 2h && sleep 30m && reboot &hope this helps. Last time I tried to set up cron on a wrt I was unable to get it figured out, but my need wasn't really that big.
moj
Usng a cron job that happens at 1am or whenever is better than trying to set up a 24 hour reboot and having the reboot happen at specific times. To figure out what to put in your /etc/crontabs/root file you can use:
http://www.csgnetwork.com/crongen.html
The discussion might have continued from here.