Scheduled reboot

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 12:16, 9 September 2011 (edit)
Shadowdogg (Talk | contribs)
(new page scheduled reboot what can be used for and how to fix potentional problems)
← Previous diff
Revision as of 19:03, 5 December 2019 (edit) (undo)
Peno (Talk | contribs)
m
Next diff →
(11 intermediate revisions not shown.)
Line 1: Line 1:
== What it can be used for == == What it can be used for ==
-Scheduled reboot is often used to give the routers a little clearing now and then to keep its performance in its peak. It can also be used in combination with uPnP with the setting "clear ports at startup" enabled to give the benefits of uPnP without the drawbacks of gaps in your security (for long periods of time anyway).+Scheduled reboot is often used to give the routers a little clearing now and then to keep its performance at its peak. It can also be used in combination with uPnP with the setting "clear ports at startup" enabled to give the benefits of uPnP without the drawbacks of gaps in your security (for long periods of time anyway).
-I often find that using a scheduled reboot often gives a brilliant transfer and receive rate for wireless which makes a huge difference when in client mode. The higher to the maximum transfer and receive (whilst assuming no other wireless clients are heavily using it such as downloading) I can receive extremely low ping between my primary router and secondary router - around 1-2 ms average with a distance of around 50metres set in the ACK timer.+I find that using a scheduled reboot often gives a brilliant transfer and receive rate for wireless which makes a huge difference when in client mode. The higher to the maximum transfer and receive (whilst assuming no other wireless clients are heavily using it such as downloading) I can receive extremely low ping between my primary router and secondary router - around 1-2 ms average with a distance of around 50 metres set in the ACK timer.
 + 
 +It is necessary for WDS to work as intended. When the WDS AP is rebooted, manually or do to power outage, the WDS stations need to reboot in order to reconnect to the WDS AP. Keep Alive, allows this. Just type in the ip of the WDS AP, put in a time of 300 or 1000 s and click apply.
== Not working as intended == == Not working as intended ==
-On DD-WRT v24-sp2 (06/14/11) Build 17201 - I have found that in client mode, scheduled reboot does not work or more so, it only does it for the first time set, despite it being put as "every day." To fix this I used code which a moderator passed onto me and hopefully it works for you too.+Up to build r41189 as per this thread: https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1177905#top, it was found that in client mode, scheduled reboot does not work or more so, it only does it for the first time set, despite it being put as "every day." To fix this I used code which a moderator passed onto me and hopefully it works for you too.
# Go to DD-WRT configuration page # Go to DD-WRT configuration page
-#Administration -> Commands+# Disable scheduled reboot in '''Administration -> Keep Alive '''
 +# '''Administration -> Commands '''
# Input # Input
Line 17: Line 20:
echo "55 5 * * * root /tmp/restart_router" > /tmp/cron.d/restartrouter echo "55 5 * * * root /tmp/restart_router" > /tmp/cron.d/restartrouter
-# Save startup+# '''Save Startup'''
# You can edit this at any time # You can edit this at any time
 +# I would also recommend giving your router a reboot just to be sure. '''Administration -> Management''' should be good enough
The above configuration will then restart every day at 5:55am assuming you have set the [[NTP]] correctly. You may also find it useful to find out more information on [[CRON]] The above configuration will then restart every day at 5:55am assuming you have set the [[NTP]] correctly. You may also find it useful to find out more information on [[CRON]]
- 
Editors note: I have no idea how to fix the numbers whilst giving the code box. Editors note: I have no idea how to fix the numbers whilst giving the code box.
 +
 +== Alternative without the need of cron ==
 +
 +# Go to DD-WRT configuration page
 +# Disable scheduled reboot in '''Administration -> Keep Alive '''
 +# '''Administration -> Commands '''
 +# Input
 +
 + >/tmp/reboot.sh
 + echo 'current_year="1970"'>>/tmp/reboot.sh
 + echo 'while [ $current_year -eq 1970 ]'>>/tmp/reboot.sh
 + echo 'do'>>/tmp/reboot.sh
 + echo ' sleep 60'>>/tmp/reboot.sh
 + echo ' current_year=$(date +"%Y")'>>/tmp/reboot.sh
 + echo 'done'>>/tmp/reboot.sh
 + echo 'current_epoch=$(date +%s)'>>/tmp/reboot.sh
 + echo 'target_epoch=$(date -d `date +"%Y%m%d0430"` +%s)'>>/tmp/reboot.sh
 + echo 'sleep_seconds=$(( $target_epoch - $current_epoch ))'>>/tmp/reboot.sh
 + echo 'if [[ ${sleep_seconds:0:1} == "-" ]] ; then sleep_seconds=$(( $sleep_seconds + 86400 )); fi'>>/tmp/reboot.sh
 + echo 'sleep $sleep_seconds'>>/tmp/reboot.sh
 + echo 'reboot'>>/tmp/reboot.sh
 + echo '/bin/sh /tmp/reboot.sh &'>/tmp/reboot0.sh
 + /bin/sh /tmp/reboot0.sh
 +
 +# '''Save Startup'''
 +# You can edit this at any time
 +# Now reboot the router. It will from now on reboot every day at 4.30 am
 +
 +[[Category:Scripts]]

Revision as of 19:03, 5 December 2019

What it can be used for

Scheduled reboot is often used to give the routers a little clearing now and then to keep its performance at its peak. It can also be used in combination with uPnP with the setting "clear ports at startup" enabled to give the benefits of uPnP without the drawbacks of gaps in your security (for long periods of time anyway).

I find that using a scheduled reboot often gives a brilliant transfer and receive rate for wireless which makes a huge difference when in client mode. The higher to the maximum transfer and receive (whilst assuming no other wireless clients are heavily using it such as downloading) I can receive extremely low ping between my primary router and secondary router - around 1-2 ms average with a distance of around 50 metres set in the ACK timer.

It is necessary for WDS to work as intended. When the WDS AP is rebooted, manually or do to power outage, the WDS stations need to reboot in order to reconnect to the WDS AP. Keep Alive, allows this. Just type in the ip of the WDS AP, put in a time of 300 or 1000 s and click apply.

Not working as intended

Up to build r41189 as per this thread: https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1177905#top, it was found that in client mode, scheduled reboot does not work or more so, it only does it for the first time set, despite it being put as "every day." To fix this I used code which a moderator passed onto me and hopefully it works for you too.

  1. Go to DD-WRT configuration page
  2. Disable scheduled reboot in Administration -> Keep Alive
  3. Administration -> Commands
  4. Input
echo "startservice run_rc_shutdown; /sbin/reboot" > /tmp/restart_router
chmod a+x /tmp/restart_router
echo "55 5 * * * root /tmp/restart_router" > /tmp/cron.d/restartrouter
  1. Save Startup
  2. You can edit this at any time
  3. I would also recommend giving your router a reboot just to be sure. Administration -> Management should be good enough

The above configuration will then restart every day at 5:55am assuming you have set the NTP correctly. You may also find it useful to find out more information on CRON

Editors note: I have no idea how to fix the numbers whilst giving the code box.

Alternative without the need of cron

  1. Go to DD-WRT configuration page
  2. Disable scheduled reboot in Administration -> Keep Alive
  3. Administration -> Commands
  4. Input
>/tmp/reboot.sh
echo 'current_year="1970"'>>/tmp/reboot.sh
echo 'while [ $current_year -eq 1970 ]'>>/tmp/reboot.sh
echo 'do'>>/tmp/reboot.sh
echo '  sleep 60'>>/tmp/reboot.sh
echo '  current_year=$(date +"%Y")'>>/tmp/reboot.sh
echo 'done'>>/tmp/reboot.sh
echo 'current_epoch=$(date +%s)'>>/tmp/reboot.sh
echo 'target_epoch=$(date -d `date +"%Y%m%d0430"` +%s)'>>/tmp/reboot.sh
echo 'sleep_seconds=$(( $target_epoch - $current_epoch ))'>>/tmp/reboot.sh
echo 'if [[ ${sleep_seconds:0:1} == "-" ]] ; then sleep_seconds=$(( $sleep_seconds + 86400 )); fi'>>/tmp/reboot.sh
echo 'sleep $sleep_seconds'>>/tmp/reboot.sh
echo 'reboot'>>/tmp/reboot.sh
echo '/bin/sh /tmp/reboot.sh &'>/tmp/reboot0.sh
/bin/sh /tmp/reboot0.sh
  1. Save Startup
  2. You can edit this at any time
  3. Now reboot the router. It will from now on reboot every day at 4.30 am