Neptune354 http://cyberstorm.altervista.org/phpBB3/ |
|
Option to periodically restart WAN connection http://cyberstorm.altervista.org/phpBB3/viewtopic.php?f=9&t=6 |
Page 1 of 1 |
Author: | diz2k [ 08 Jun 2007, 14:58 ] |
Post subject: | Option to periodically restart WAN connection |
My provider disconnects my connection every 24h of uptime. Would it be possible to have an option to do this manually on some choosed time? Like a cron job but as I understand, router does not have cron. It would be nice because I could set it to disconnect like at 5 in the morning and wouldn't have to worry that it will disconnect in the middle of a game or some other important thing. |
Author: | cyberstorm [ 08 Jun 2007, 17:01 ] |
Post subject: | Re: Option to periodically restart WAN connection |
The firmware has cron.I think that for your goal all you need to do is put in /mnt/script.sh this: Code: #! /bin/sh echo "00 05 * * * killall pppd" > /tmp/cron.d/restart_wan After creating the file script.sh, remember to umount /mnt/, otherwise changes are not saved. Test it (maybe with another hour ![]() |
Author: | diz2k [ 11 Jun 2007, 10:59 ] |
Post subject: | Re: Option to periodically restart WAN connection |
cyberstorm wrote: After creating the file script.sh, remember to umount /mnt/, otherwise changes are not saved. Test it (maybe with another hour ![]() Thanks a lot. Will try it as soon as I get additional partition to mount. Do you know if Carciofone is working on a fix for mount problem? |
Author: | diz2k [ 11 Jun 2007, 15:10 ] |
Post subject: | Re: Option to periodically restart WAN connection |
I haven't noticed that there was already fixed version when I've posted this. Thanks Carciofone. ![]() I've tried your method and it does not quite wants to work. Added restart_wan (not sure if it's needed but I've also set 'x' permission to it) to /tmp/cron.d/ with that content: Code: 00 15 * * * killall pppd and connection is still happily working at 15:01 Code: Current Time: Mon 11 , Jun 2007 15:01:18
Connection uptime: 0 Days, 2 Hours, 13 Minutes, 1 Second |
Author: | diz2k [ 11 Jun 2007, 17:37 ] |
Post subject: | Re: Option to periodically restart WAN connection |
I think I got it working. First, I had to add user name in cron line: Code: 00 15 * * * root killall pppd Second, I had to killall cron process and start it again because it seems it's not picking up new or modified jobs by itself. I can do this in startup script. Is killing the best way to do this? |
Author: | cyberstorm [ 11 Jun 2007, 20:34 ] |
Post subject: | Re: Option to periodically restart WAN connection |
you have to restart cron only if it is already running when you add a job. Unluckily startup script is run after the start of cron, so you need to restart it. Or maybe try a "killall -HUP cron" to see if new jobs are read. If not you just need to put this 2 lines in script.sh: Code: killall cron cron There is not an easy way to change the order of application start, the only way is modify the source code. Sorry I forgot about adding "root" to crontab. |
Author: | diz2k [ 11 Jun 2007, 21:58 ] |
Post subject: | Re: Option to periodically restart WAN connection |
Yep, I did killall cron. But I had to specify full path /usr/sbin/cron |
Author: | _MOI_ [ 04 Oct 2007, 16:00 ] |
Post subject: | Re: Option to periodically restart WAN connection |
Hi, I wonder if there is a way to know if the connection is still alive or not, because my wan connection drops down some time without reason. I will use this in a cron job to check every 30 min if the wan is still alive. TIA, _MOI_ Edit : It's ok, I test it with the result status of a ping |
Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |