Posted: Sun Jun 23, 2013 20:27 Post subject: Daily cron reboots
I've read about the known issues with the reboot scheduler in v24 via Administration > Keep Alive so I've been trying to get the reboots to occur via my own cron job. There are a number of posts which suggest using the below commands on startup via Administration > Commands. I modified the command to run every 5 minutes while I test to verify that it's functioning as intended.
However, I haven't actually been able to get this to work. I verified that the /tmp/restart_router and /tmp/cron.d/restartrouter files are all created with the correct permissions at startup, but the reboot never actually occurs.
I also fiddled around with the Additional Cron Jobs via Administration > Management. I was able to get the reboot to occur once with this method, but not on a recurring basis which is similar to the known defect in the Keep Alive reboot scheduler (I'm not sure if the root cause is identical for the two issues).
I've tried modifying the script, investigating the PATH environment variables, verifying cron is enabled/running, and experimenting with different cron functionality within dd-wrt to no avail. Any thoughts on what the issue might be and how I can go about troubleshooting this further?
This is because you have omitted '#/bin/sh' in the beginning of the script. Try to add it to your script as a first line and everything must be okay. This is a known issue that deals with shell scripts on dd-wrt in the last year.
I may have spoken a bit prematurely. This appears to be working on my WDS AP, but not on my WDS Station device. Both are identical physicals devices with the same firmware version. I remember reading about someone else having the same issue, but I can't seem to find the post again. Any ideas?
I've been doing some tinkering to try to get this work and trying to get creative, but I've run out of ideas. Anyone have any ideas besides walking my lazy behind the TV to reset the router on a regular basis?
Posted: Fri May 06, 2016 2:25 Post subject: I got this to work, here's how
I know this is an old thread, but since I never found the answer anywhere that worked, and I just got this to work after playing with it a few days, I thought I would post my solution here.
The restart_router script entry in /tmp/restart_router indeed needs the shebang portion or it will not run.
The echo commands in post #3 won't echo both lines to the restart_router file
I discovered that the cron entry ran every time if I manually used vi to edit in the shebang into the restart_router entry.
so my solution is this:
1) enable JFFS in Administration per instructions on DD-WRT Wiki, FOLLOW IINSTRUCTIONS! OR BRICK Maybe
2) mkdir /jffs/etc
3) touch /jffs/etc/restart_router
4) chmod a+x /jffs/etc/restart_router
5) I used vi to edit /jffs/etc/restart_router to be this:
#!/bin/sh
startservice run_rc_shutdown; /sbin/reboot
6) Then here is my Administration >> Command >> for startup