Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: How set up a cron job for everyday TIVO reboot

  1. #1

    Question How set up a cron job for everyday TIVO reboot

    Hi,

    I've just got my TIVO running closer to normal now, that is if I reboot it every day...otherwise it will freeze or the sound will cut off...


    So I was wondering if anyone know how i could set up a cron job for the tivo to reboot say 4 am every morning ?

    Thanks, have a good day !

    Regards

    Arve

  2. #2
    Join Date
    Apr 2004
    Location
    Perth, Western Australia
    Posts
    3,032
    Hi,

    Cron entry: Add the following to /hack/etc/crontab to execute the script every day @ 4am. Ensure a blank line remains at the end of the file.

    00 04 * * * root reboot

    Peter.
    Please search this forum and our Website for your TiVo questions before starting a new thread. Thanks!

  3. #3
    Join Date
    May 2004
    Location
    Wellington, NZ
    Posts
    477
    Quote Originally Posted by arvesolland
    I've just got my TIVO running closer to normal now, that is if I reboot it every day...otherwise it will freeze or the sound will cut off...
    It is better to resolve the issue rather rather than try work around it via reboots. The freezing is likely caused by TivoWeb... in which case you should seriously consider either removing the phone.itcl module, or replace it with TivoWebPlus. The sound cutting out is possibly a software issue, if you could provide some information on the setup of your Tivo as well as a dump of the PALMOD messages ("grep PALMOD /var/log/kernel") then that too could be looked into.

    This is the third posting I have replied to from a user concerning sound loss... but it seems that nobody is prepared to provide the log entries that would help determine if the issue can be resolved with a software update. If anyone is getting this regularly then I am happy to work through the the issue with them and provide software updates for them to try and resolve or determine what the issue is.

  4. #4
    Join Date
    May 2004
    Location
    Wellington, NZ
    Posts
    477
    Quote Originally Posted by arvesolland
    So I was wondering if anyone know how i could set up a cron job for the tivo to reboot say 4 am every morning ?
    If you do still wish to schedule regular reboots and are worried about rebooting in the middle of a recording and possibly loosing a few minutes of a show, then you could use a script similar to the following rather than the reboot command (I have not tested this so it may need tweaking):

    Code:
    #!/tvbin/tivosh
    #
    # safereboot.tcl <age>
    #
    # Check if there are recordings active before rebooting
    #
    # Can optionally check to see if the system has been up
    # <age> hours before rebooting.
    
    set reboot 1
    set db [dbopen]
    
    if {$argc > 0} {
       set age    [lindex $argv 0]
       set uptime [lindex [exec cat /proc/uptime] 0]
       set uptime [expr int($uptime)]
    
       if {$uptime < [expr $age * 3600]} {
          if {$age > 1} {
    	 puts "Tivo has rebooted in the last $age hours, skip reboot"
          } else {
    	 puts "Tivo has rebooted in the last hour, skip reboot"
          }
          exit
       }
    }
    
    ForeachMfsFile fsid name type "/Recording/InProgress" "" {
       RetryTransaction {
          set rec   [db $db openid $fsid]
          set state [dbobj $rec get State]
          if {$state == 3} {
    	 set seltype [dbobj $rec get SelectionType]
    	 switch $seltype {
    	    0        {# Ignore LiveBuffer recordings}
    	    6        {# Ignore Suggestion recordings}
    	    default  {set reboot 0}
    	 }
          }
       }
    }
    
    if {$reboot == 0} { 
       puts "Currently recording, can't reboot"
    } else {
       puts "No recordings active, rebooting"
       exec /tvbin/reboot 
    }
    Last edited by thomson; 04-03-2006 at 02:14 PM. Reason: Tweaked the script

  5. #5
    Join Date
    Mar 2004
    Location
    Wellington, NZ
    Posts
    570
    I reboot via cron myself at 4am every morning (both my tivos do) no problems whatsoever using this method.

  6. #6
    Join Date
    Apr 2004
    Location
    Perth, Western Australia
    Posts
    3,032
    Quote Originally Posted by thomson
    If you do still wish to schedule regular reboots and are worried about rebooting in the middle of a recording and possibly loosing a few minutes of a show, then you could use a script similar to the following rather than the reboot command (I have not tested this so it may need tweaking):
    Thought I'd play with the script.

    I get the following error though:

    Code:
    safereboot.tcl: line 17: syntax error near unexpected token `int($'
    safereboot.tcl: line 17: `   set uptime [expr int($uptime)]'
    Peter.
    Please search this forum and our Website for your TiVo questions before starting a new thread. Thanks!

  7. #7
    Join Date
    May 2004
    Location
    Wellington, NZ
    Posts
    477
    Quote Originally Posted by petestrash
    I get the following error though:
    Code:
    safereboot.tcl: line 17: syntax error near unexpected token `int($'
    safereboot.tcl: line 17: `   set uptime [expr int($uptime)]'
    Could be a transfer error... with TCL scripts it is best to do a "dos2unix script.tcl; chmod 755 script.tcl" to ensure it is in the correct format. I have also attached the script to avoid any unusual cut and paste errors.

    I do maintain that there is no need to schedule regular reboots of a TiVo, and I am happy to work through the issues with anyone that wishes to get their system running more reliably.
    Attached Files Attached Files

  8. #8
    Join Date
    Apr 2004
    Location
    Perth, Western Australia
    Posts
    3,032
    Quote Originally Posted by thomson
    Could be a transfer error... with TCL scripts it is best to do a "dos2unix script.tcl; chmod 755 script.tcl" to ensure it is in the correct format. I have also attached the script to avoid any unusual cut and paste errors.
    I just copy and paste into joe. It looked good, though I have had issues pasting scripts into joe before.

    I have just ftp'd your attached file and have the same errors.

    Code:
    [TiVo [p0] /var/hack]# dos2unix safereboot.tcl
    dos2unix: converting file safereboot.tcl to UNIX format ...
    [TiVo [p0] /var/hack]# chmod 777 safereboot.tcl
    [TiVo [p0] /var/hack]#
    [TiVo [p0] /var/hack]# ls -l safereboot.tcl
    -rwxrwxrwx   1 0        0            1110 Mar  5 19:27 safereboot.tcl
    [TiVo [p0] /var/hack]#
    [TiVo [p0] /var/hack]# sh safereboot.tcl
    safereboot.tcl: line 16: syntax error near unexpected token `int($'
    safereboot.tcl: line 16: `   set uptime [expr int($uptime)]'
    [TiVo [p0] /var/hack]#
    [TiVo [p0] /var/hack]# cat safereboot.tcl
    #!/tvbin/tivosh
    #
    # safereboot.tcl <age>
    #
    # Check if there are recordings active before rebooting
    #
    # Can optionally check to see if the system has been up
    # <age> hours before rebooting.
    
    set reboot 1
    set db [dbopen]
    
    if {$argc > 0} {
       set age    [lindex $argv 0]
       set uptime [lindex [exec cat /proc/uptime] 0]
       set uptime [expr int($uptime)]
    
       if {$uptime < [expr $age * 3600]} {
          if {$age > 1} {
             puts "Tivo has rebooted in the last $age hours, skip reboot"
          } else {
             puts "Tivo has rebooted in the last hour, skip reboot"
          }
          exit
       }
    }
    
    ForeachMfsFile fsid name type "/Recording/InProgress" "" {
       RetryTransaction {
          set rec   [db $db openid $fsid]
          set state [dbobj $rec get State]
          if {$state == 3} {
             set seltype [dbobj $rec get SelectionType]
             switch $seltype {
                0        { # Ignore Live Buffer recordings}
                6        { # Ignore Suggestion recordings}
                default  {set reboot 0;}
             }
          }
       }
    }
    
    if {$reboot == 0} {
       puts "Currently recording, can't reboot"
    } else {
       puts "No recordings active, rebooting"
       exec /tvbin/reboot
    }[TiVo [p0] /var/hack]#

    Quote Originally Posted by thomson
    I do maintain that there is no need to schedule regular reboots of a TiVo, and I am happy to work through the issues with anyone that wishes to get their system running more reliably.
    I don't have any real issues, uptimes are generally 14-30 days.

    freezes only tend to occur after a heavy session catching up on shows where the remote is used excessively. Or when a lot of SP's are modified or added/deleted.

    Just thought I'd try it on one unit and see if we still get the occasional freezes.

    Peter
    Please search this forum and our Website for your TiVo questions before starting a new thread. Thanks!

  9. #9
    Join Date
    May 2004
    Location
    Wellington, NZ
    Posts
    477
    Quote Originally Posted by petestrash
    [TiVo [p0] /var/hack]# sh safereboot.tcl
    safereboot.tcl: line 16: syntax error near unexpected token `int($'
    safereboot.tcl: line 16: ` set uptime [expr int($uptime)]'
    This is a TCL script not a Bourne(sh) script. It should be run with the full path or in your case './safereboot.tcl'.

  10. #10
    Quote Originally Posted by thomson
    It is better to resolve the issue rather rather than try work around it via reboots. The freezing is likely caused by TivoWeb... in which case you should seriously consider either removing the phone.itcl module, or replace it with TivoWebPlus. The sound cutting out is possibly a software issue, if you could provide some information on the setup of your Tivo as well as a dump of the PALMOD messages ("grep PALMOD /var/log/kernel") then that too could be looked into.

    This is the third posting I have replied to from a user concerning sound loss... but it seems that nobody is prepared to provide the log entries that would help determine if the issue can be resolved with a software update. If anyone is getting this regularly then I am happy to work through the the issue with them and provide software updates for them to try and resolve or determine what the issue is.
    Hi Thomson,

    Thanks for your reply.
    the sound cutting out is my major problem at the moment, hasn't happened for a couple of days now, but the other day, 80% of recorded shows on that day were without sound

    I tried doing a grep PALMOD /var/log/kernel but i dont get anything at the moment, its just a few hours since the morning reboot though....
    Im only using a austar STB (QLD) at the moment, no FTA so will any PALMOD errors still show up even though Darren has not modded my box ?

    Guess I could set up a cron to dump the grep PALMOD /var/log/kernel into a file just before each reboot to catch it all.....

    I really appreciate your help thompson, as I would love to resolve the issues as well, not just work around them

    Thanks,

    Have a good day !
    Regards

    Arve

Similar Threads

  1. swupdate cron script and log
    By boritz in forum Australian TiVoHD
    Replies: 2
    Last Post: 14-03-2018, 04:56 PM
  2. Tivo stuck in reboot
    By CheshireCat in forum NZ TiVoHD
    Replies: 1
    Last Post: 09-01-2012, 08:46 PM
  3. Tivo losing sound - comes back after reboot
    By chrishowell in forum Question and Answer Forum
    Replies: 56
    Last Post: 29-03-2007, 12:50 PM
  4. Newbie CRON question
    By dyrplq in forum Question and Answer Forum
    Replies: 2
    Last Post: 21-12-2005, 04:22 PM
  5. Tivo throws setting each reboot
    By Tony in forum New Zealand General Forum
    Replies: 0
    Last Post: 20-11-2004, 06:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •