PDA

View Full Version : How set up a cron job for everyday TIVO reboot



arvesolland
03-03-2006, 11:48 AM
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

petestrash
03-03-2006, 03:53 PM
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.

thomson
03-03-2006, 04:12 PM
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.

thomson
03-03-2006, 05:47 PM
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):



#!/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
}

zollymonsta
04-03-2006, 08:56 AM
I reboot via cron myself at 4am every morning (both my tivos do) no problems whatsoever using this method.

petestrash
05-03-2006, 05:43 PM
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:


safereboot.tcl: line 17: syntax error near unexpected token `int($'
safereboot.tcl: line 17: ` set uptime [expr int($uptime)]'

Peter.

thomson
05-03-2006, 09:51 PM
I get the following error though:

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.

petestrash
05-03-2006, 10:43 PM
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.


[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]#





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

thomson
06-03-2006, 08:54 AM
[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'.

arvesolland
06-03-2006, 09:03 AM
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

thomson
06-03-2006, 01:21 PM
Im only using a austar STB (QLD) at the moment, no FTA so will any PALMOD errors still show up...

Hmm... that's a little more interesting... my understanding is that there should be very little "processing" being performed on the left/right audio from a STB connection.

I have attached a version of palmod that includes some debugging output. This may help us determine if some software tweaking is possible. I would strongly suggest implementing the failsafe mechanism outlined in this post (http://www.forums.oztivo.net/showpost.php?p=2434&postcount=1) to ensure that you will never get stuck in a reboot loop when running development palmod modules.

petestrash
06-03-2006, 02:43 PM
This is a TCL script not a Bourne(sh) script. It should be run with the full path or in your case './safereboot.tcl'.

:o Works now.



Hmm... that's a little more interesting... my understanding is that there should be very little "processing" being performed on the left/right audio from a STB connection.

I have see hardware faults cause the issue described, from memory some caps need to be changed on the mainboard.

Maybe Darren can add to this.

Peter

thomson
06-03-2006, 07:31 PM
the sound cutting out is my major problem at the moment

Are you running a CacheCard? If you are then you might like to check the firmware revision of the card. More information can be found here (http://www.9thtee.com/TiVoCacheCard-22.htm).

It is also handy to know if changing the channel solved the sound issue. For instance, if there is no sound does changing the channel reset it? Have you ever had the sound disappear while watching a show... does it sometimes disappear partway into a show, or always at the beginning? These questions will also help determine if it is a software versus hardware issue.

arvesolland
13-03-2006, 02:37 PM
Are you running a CacheCard? If you are then you might like to check the firmware revision of the card. More information can be found here (http://www.9thtee.com/TiVoCacheCard-22.htm).

It is also handy to know if changing the channel solved the sound issue. For instance, if there is no sound does changing the channel reset it? Have you ever had the sound disappear while watching a show... does it sometimes disappear partway into a show, or always at the beginning? These questions will also help determine if it is a software versus hardware issue.


Hi, im running a x-factor 1.0 card. I will try changing the channels when the sound is out next time, i vaguely remember doing it once and the sound didnt come back until rebooting...but im not sure.
The sound can dissapear at any time, not just at the start of the show. After the sound cuts out, the video also shows some artifacts and sometimes becomes jerky.

petestrash
13-03-2006, 03:39 PM
After the sound cuts out, the video also shows some artifacts and sometimes becomes jerky.

The fact that it also affects the image is interesting.

Have you tried a using a different drive?

Even a small test drive, I think about 2gig is the smallest the image will load on to to see if the problem still occurs.

Also if you want to rule out the network card as being an issue, you can safely remove it for a week and see what happens. You don't show your location, but assuming your in Australia, the best day to try is Sunday after making a daily call. you should have data through to next Saturday.

Peter.

arvesolland
17-03-2006, 12:15 PM
Hi,

I just experienced a sound loss again yesterday. The video got jerky as well....
I tried up/down in the channels and it worked! Everything went back to normal.
Anyone have any ideas why this happens ?
I did a dump of the kernel log and piped into a grep PALMOD, but nothing there,,,,,,,
Any ideas ?

Thanks,

Arve

zollymonsta
17-03-2006, 02:03 PM
Yah I've had that.. channel up down fixes it.

It comes and goes (hasn't happened for 2+ months now).

If you extract the video, from memory, there is no audio. I suspect that is why the video becomes jerky.

petestrash
17-03-2006, 03:03 PM
I just experienced a sound loss again yesterday. The video got jerky as well....
I tried up/down in the channels and it worked! Everything went back to normal.
Anyone have any ideas why this happens ?

Are you using a new HDD in your TiVo or is one of the original drives?

When I have seem similar sound issues, it did not affect the picture.

Do you have any spare HDD's, even just a few Gb would be enough to load the image onto and test a few days to see if the sound and reboot issues go away.

Peter.

argo
08-05-2006, 06:23 PM
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.

'root reboot' - how is this command different from 'reboot'

Adding 'root reboot' to crontab as above does not seem to carry out a reboot on my system (V1.5)?

thomson
08-05-2006, 09:29 PM
'root reboot' - how is this command different from 'reboot'

Cron varies between systems... in the above example (usually reserved for system crontab files) it means execute the reboot command as the 'root' user.

This is not expected for the crontab files on the TiVo, so just '05 03 * * * reboot' should reboot the system at 03:05am each day.

bigmal
24-06-2006, 11:17 AM
I read this thread a while ago and decided to load a cron job reboot at 4am every day as well. The Tivo has been running flawlessly ever since.

However, sometimes my guide data isn't fully indexed and programs aren't being found by my wishlists. Forcing an index fixes this problem. Thus I'm wondering if my Tivo decides to do a daily call at say 3:45am and then the cron job reboots it (while it's still indexing) then does the indexing ever get completed? (ie. after rebooting)

Is it possible to load a cron job that will only reboot the tivo if it's not indexing?

Thanks in advance, Jeremy.

P.S. I got my first tivo a few months ago and love it so much I have two more on the way from the States :-) Keep up the great work fellas!

petestrash
24-06-2006, 12:18 PM
I haven't heard of reboots causing indexing problems, it should restart the indexing after the reboot.

But if you want to be sure, you could always add an indexing line to cron like:

00 04 * * * /var/hack/bin/force_index.tcl > /var/log/force index 2>&1 &

Peter.

bigmal
25-06-2006, 08:18 AM
Thanks Pete, I'll give that a try.

If the Tivo is smart enough to continue indexing after a reboot then what other possible reasons would there before my Tivo not indexing? I didn't find any evidence of a warped clock or anything.

Cheers, Jeremy.

petestrash
25-06-2006, 01:03 PM
I haven't heard of anyone with the same problems.

A lot of people use the early morning reboot, so if that was causing it I should have heard by now.

It does sound like a warped clock issue, but as you said there was no evidence of that.

Peter.