1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script to reboot Router after X amount of days - Tomato 1.23

Discussion in 'Tomato Firmware' started by venom, Apr 6, 2009.

  1. venom

    venom Networkin' Nut Member

    Hello,

    I am very new to Tomato and know nothing about Linux. I have a question about scripting.

    Goal: To reboot the router after X amount of days (For me, 30 days)

    I noticed on the FAQ this:
    # cru a TwiceMonthlyReboot "0 3 1,15 * * reboot"
    (03:00, 1st and 15th of every month)

    Since my Linux skills are zero, I couldn't figure out a way to schedule or set this up on my Tomato firmware under the Tomato Scheduler Custom 1 settings. Is it possible to setup what I need?

    Thanks!
     
  2. bogderpirat

    bogderpirat LI Guru Member

    lose the ",15" and add:

    cru a twicemonthly reboot 0 3 1 * * reboot


    under scheduler/reboot, you could select "every ..." under time and insert 2592000 (=30*24*60^2)
     
  3. venom

    venom Networkin' Nut Member

    Thanks for the reply. I am still a tad confused on how to implement this.

    On Tomato 1.23, I went to the Scheduler
    Custom 1
    Enabled
    Time minutes
    Days Sun Mon Tue Wed Thu Fri Sat Everyday
    Command:
    cru a 1stOfTheMonth reboot 0 3 1 * * reboot

    However, how would I enable this? I simply want a reboot at say the 1st of the month at 5am PST.

    Should I enable this with Minutes set to 43829 (30 days)? Or would simply saying run this command every Sunday to initiate it work? What I am afraid of is that if I enable a day it will simply reset the Command.

    Sorry for being a dunce, just not clear on all this.

    Thanks!
     
  4. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    You either want to use the Scheduler page OR the cru command, but not both (ie don't put a cru command in the Scheduler page). The most direct way would be to place
    Code:
    cru a MonthlyReboot 0 5 1 * * reboot
    in your Init script (reboots the router at 5AM local time on the 1st of every month).
     
  5. bripab007

    bripab007 LI Guru Member

    Or go to Admin > Scheduler, select "Every" from the drop-down, type in "43200" in the minutes text box.
     
  6. venom

    venom Networkin' Nut Member

    Thank you both, I did not see the Script section below the Scheduler. I added:
    cru a MonthlyReboot 0 5 1 * * reboot

    To the Init area and saved. I suspect I will have to do a reboot to enable that script to take effect.

    For bripa007 - What would be the Custom Command to reboot the router using the Every X minutes. Not that I plan to use both, just wanted to know for reference.

    Lastly, with either, is there a way to specify the time? For the Init Script what time will it reboot at its current setting and how could I force it to happen on the 1st of the month at 5am. Or is that what the "5" means in the script using military time?

    Thanks again folks, I really appreciate you taking the time to help.
     
  7. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    But, he can't specify a certain day of the month or time of day that way...
    Yes, the command I gave already schedules it for 5AM local time on the 1st of every month.

    The format is
    Code:
    cru <a==add> <name> <minute> <hour> <day> <month> <dayofweek>
    For any of the time/date arguments you can pass a '*' for any (we specified any month for your command) or '*/<#>' for every (*/30 in the minutes column would schedule it to run once every thirty minutes). And, as you guessed, the hour is 0-23.
     
  8. venom

    venom Networkin' Nut Member

    Thank you very much! You've definitely explained it perfectly and again I appreciate you taking the time to help me out.
     
  9. The Doctor

    The Doctor Networkin' Nut Member

    Venom, I have nothing to offer you on how to complete the task you are inquiring about, it also looks like your question has been well answered above, but I will offer you this observation. If you are wanting to do a regular reboot because you feel your router will occasionally get loaded down, or lockup after a period of time, I can tell you this will probably not be necessary. I ran Tomato v1.09 for over a year without rebooting, under pretty heavy peer-to-peer use, with absolutely no problem. Currently running the Victek mod of v1.23 for 37 days constant, with number of open TCP connections rarely dropping below 100, and transfer rate rarely dropping below 10Mb during this time, and the router is showing no signs of instability. This is on a Buffalo WHR-HP-G54.

    I realize that you may be wanting to reboot for a completely different reason, but if performance or stability is what you are thinking of, take my example on tomato being extremely stable.


    Good luck
    Ed
     
  10. venom

    venom Networkin' Nut Member

    Doctor,

    I am indeed rebooting the router due to perceived instability over extended periods of time using DDWRT v23 SP2. I and my roomates will use the Tomato(ed) v 1.23 router pretty heavy so I will try 30 days and then extend that time if needed.

    I appreciate the feedback though!
     
  11. bripab007

    bripab007 LI Guru Member

    Good point, Ed. After having spent a few years in the world of DD-WRT, coming to the Tomato side was indeed a revelation for me, especially with regard to stability :biggrin:
     
  12. TheGIZ

    TheGIZ LI Guru Member

    Do you ever notice that TOmato units set up as WAPs tend to lose the GUI after some period of time? I see this from time to time. A reboot cures it. So I guess I could try the schedular... but can a WAP tell time?
     
  13. bripab007

    bripab007 LI Guru Member

    A Wireless Access Point should be able to tell time if you configure the NTP client in the Time section of the Tomato GUI.
     

Share This Page