Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27

Thread: Looking for "smart" reboot script

  1. #16
    Join Date
    Jan 2003
    Posts
    28
    So, there is no file that gets run on a daily basis in 3.1?

    All I was going to do was add to the script that already gets run on a daily basis and if the date were to equal 3 or 5 or 10 etc.. then I would have it run the reboot script.

    I did this to the TClient-lib file in 2.5.2 and had it set to where if the date was 14 or 28 then it would run a script I made to delete the history.

    I am just not sure what, if any, files get run on v3.1 on a daily basis that I could edit and add to like I did in v2.5.2.

  2. #17
    Join Date
    May 2003
    Posts
    63

    Command not found

    Hi All,

    I was playing with the sample script here, and keep getting a command not found error on ForeachMfsfile...

    Where should that be?

    Thanks!
    Even I donated because this place has saved me more time and money than I could even count...

  3. #18
    Join Date
    May 2003
    Posts
    4
    Originally posted by rc3105
    just add/remove seltype matches to suit the particular use
    Does anyone have a list (or can point me to the list) of all the SelectionTypes? Just trying to cover all my bases on when I want it to reboot. Silverdude posted this piece of code:

    Code:
    switch $seltype { 
        # 15 { set reboot 0 ;puts "15 - " }
        # 14 { set reboot 0 ;puts "14 - " }
        13 { set reboot 0 ;puts "13 - WishList" } 
        # 12 { set reboot 0 ;puts "12 - " }
        # 11 { set reboot 0 ;puts "11 - " } 
        # 10 { set reboot 0 ;puts "10 - " } 
        9 { set reboot 0 ;puts "9 - Seasone Pass" } 
        # 8 { set reboot 0 ;puts "8 - " } 
        # 7 { set reboot 0 ;puts "7 - " }
        6 { set reboot 0 ;puts "6 - Suggestion" } 
        # 5 { set reboot 0 ;puts "5 - " } 
        # 4 ( set reboot 0 ;puts "4 - " } 
        # 3 { set reboot 0 ;puts "3 - Manual Recording" } 
        # 2 { set reboot 0 ;puts "2 - " } 
        # 1 { set reboot 0 ;puts "1 - " }
        # default { set reboot 0 ;puts "Default" }
    }
    Wishlist, Season Pass, Suggestion, and Manual Recording are labeled. Can anyone complete the list?

    Thanks!
    Last edited by gb498; 11-14-2003 at 03:50 AM.

  4. #19
    Join Date
    Jun 2001
    Posts
    3,108
    well, lets see...what other things the tivo records

    service data downloads
    starz video on demand
    clips for showcases?
    Step one: search button!
    Silly Wabbit, guides are for kids

  5. #20
    Join Date
    Mar 2002
    Posts
    1,339
    poke though tivoweb, the display SelectionTypes (and many many other things) are defined in there
    ---
    Give a man a fish and he will eat for a day. Teach a man to fish and he will sit in a boat all day and drink beer

  6. #21
    Join Date
    May 2003
    Posts
    4
    Originally posted by rc3105
    poke though tivoweb, the display SelectionTypes (and many many other things) are defined in there
    Ahhh, excellent suggestion. I will check it out and post my findings. Thanks.

  7. #22
    Join Date
    May 2003
    Posts
    4
    OK, for anyone else who might be interested, here are all the different SelectionTypes for a recording, as taken from Tivoweb module ui.itcl:

    1 Show Recommendation
    2 Package Recommendation
    3 By Name
    4 By Channel
    5 Manual
    6 Suggestion
    7 Fuzzy Package
    8 Bookmark
    9 Season Pass
    10 Manual Season Pass
    11 Guide
    12 IPreview
    13 WishListPass
    14 Extended
    15 ManualExtended
    16 CaptureRequest
    17 DailyData

    I don't know what some of them are, but it seems to me that one might also want to reboot on 1,2,7,8,12,14,15,16,17. But again I'm not sure exactly what these are, they just don't sound like critical, user-initiated recordings.

  8. #23
    Join Date
    May 2003
    Posts
    63
    Hi All,

    I asked once before, but never got a response...

    One last try

    I installed a fresh 3.1 image, and have not been able to use the scripts posted in this thread.

    I always get an error on ForeachMfsfile, saying command not found...

    Can anyone else on 3.1 help me?

    Thanks!
    David
    Even I donated because this place has saved me more time and money than I could even count...

  9. #24
    Join Date
    Nov 2004
    Posts
    31
    Trying to run script:
    #!/tvbin/tivosh
    # safe_reboot.tcl-
    # reboots ONLY if there aren't any suggestion recordings in progress
    set db [dbopen] ;set reboot 1
    set mfspath /Recording/InProgress
    ForeachMfsFile fsid name type "$mfspath" "" {
    RetryTransaction {
    set rec [db $db openid $fsid]
    set state [dbobj $rec get State]
    switch $state {
    3 {
    set seltype [dbobj $rec get SelectionType]
    switch $seltype {
    6 { #puts "suggestion - reboot away" }
    0 { #puts "live buffer?" }
    default { set reboot 0 }
    }
    }
    default { }
    }
    }
    }
    if { $reboot } { puts "rebooting" ;exec /tvbin/reboot }
    puts "busy, can't reboot"

    Output:
    tivo:/var/hack/bin$ . /var/hack/bin/safe_reboot.tcl
    bash: ForeachMfsFile: command not found
    bash: RetryTransaction: command not found
    bash: switch: command not found
    bash: 3: command not found
    bash: switch: command not found
    bash: 6: command not found
    bash: 0: command not found
    bash: default: command not found
    : command not found
    : command not found
    bash: default: command not found
    : command not found
    : command not found
    : command not found
    bash: /var/hack/bin/safe_reboot.tcl: line 25: syntax error: unexpected end of file

  10. #25
    Join Date
    Jan 2002
    Location
    New York
    Posts
    2,407

  11. #26
    Join Date
    Jan 2006
    Posts
    120
    Quote Originally Posted by Silverdude View Post
    I really gotta stop playing this this stuff. I accomplish so little.... If anyone can explain why this doesnt work let me know. It doesnt reboot, i just wanted it to show the status of the recordings, it is useless, i was just curious...

    #!/tvbin/tivosh
    # safe_reboot.tcl by rc3105@dealdatabase.com/forum
    # reboots ONLY if there aren't any suggestion recordings in progress
    #
    set db [dbopen] ;set reboot 1
    set mfspath /Recording/InProgress
    ForeachMfsFile fsid name type "$mfspath" "" {
    RetryTransaction {
    set rec [db $db openid $fsid]
    set state [dbobj $rec get State]
    switch $state {
    3 { set seltype [dbobj $rec get SelectionType]
    switch $seltype {
    # 15 { set reboot 0 ;puts "15 - " }
    # 14 { set reboot 0 ;puts "14 - " }
    13 { set reboot 0 ;puts "13 - WishList" }
    # 12 { set reboot 0 ;puts "12 - " }
    # 11 { set reboot 0 ;puts "11 - " }
    # 10 { set reboot 0 ;puts "10 - " }
    9 { set reboot 0 ;puts "9 - Seasone Pass" }
    # 8 { set reboot 0 ;puts "8 - " }
    # 7 { set reboot 0 ;puts "7 - " }
    6 { set reboot 0 ;puts "6 - Suggestion" }
    # 5 { set reboot 0 ;puts "5 - " }
    # 4 ( set reboot 0 ;puts "4 - " }
    # 3 { set reboot 0 ;puts "3 - Manual Recording" }
    # 2 { set reboot 0 ;puts "2 - " }
    # 1 { set reboot 0 ;puts "1 - " }
    # default { set reboot 0 ;puts "Default" }
    }
    }
    default { }
    }
    }
    }
    if { $reboot } { puts "rebooting" ;exec /tvbin/reboot }
    puts "busy, can't reboot"
    Trying this on a HR10-250 6.3e sodtware
    #!/tvbin/tivosh
    #
    set db [dbopen]
    set reboot 1
    set mfspath /Recording/InProgress

    ForeachMfsFile fsid name type "$mfspath" "" {
    RetryTransaction {
    set rec [db $db openid $fsid]
    set state [dbobj $rec get State]
    switch $state {
    3 {
    set seltype [dbobj $rec get SelectionType]
    switch $seltype {
    13 { set reboot 0 ; puts "13 - WishList" }
    9 { set reboot 0 ; puts "9 - Seasone Pass" }
    6 { set reboot 1 ; puts "6 - Suggestion" }
    3 { set reboot 0 ; puts "3 - Manual Recording" }
    }
    }
    default { }
    }
    }
    }

    if { $reboot == 0 } {
    puts "busy, can't reboot"
    # no reboot
    }

    if { $reboot == 1 } {
    puts "rebooting"
    # reboot tivo here
    }

    IT seems that even if its a manual record or season pass it shows $state to be 3
    not tested for suggestion or wishlist yet but I bet they will all be State 3 and Selection type 3

    I was trying to create a restart only if the tivo is NOT recording a 'manual recording', 'season pass', 'wishlist' or 'playing a recording'.

  12. #27
    Join Date
    Jan 2006
    Posts
    120
    This works. All I need todo is figure out if the tivo is playing a recording or not.
    This will check to see if the tivo is recording a season pass / manual record / wishlist and if so not to reboot
    who cares about sugestions


    #!/tvbin/tivosh
    #
    set db [dbopen]
    set count 0
    set mfspath /Recording/InProgress

    ForeachMfsFile fsid name type "$mfspath" "" {
    RetryTransaction {
    set rec [db $db openid $fsid]
    set indexpath [dbobj $rec get IndexPath]
    #puts "."
    #puts "."
    #puts "show $indexpath "
    set rebrecord 1
    set rebcache 0
    set rebsuggest 0

    # 1st /Recording/InProgress/
    if {![string match "*/Recording/InProgress/*" $indexpath]} {
    # puts "not a /Recording/InProgress/ reboot"
    set rebrecord 0
    } else {
    #puts "is /Recording/InProgress/ DO NOT REBOOT"
    set rebrecord 0
    }
    # 2nd /Recording/LiveCache/
    if {![string match "*/Recording/LiveCache/*" $indexpath]} {
    # puts "not a /Recording/LiveCache/ ok to reboot"
    # set rebcache 1
    } else {
    #puts "is a /Recording/LiveCache/ ok to reboot"
    set rebcache 1
    }
    # 3rd SUGGESTION
    if {![string match "*SUGGESTION*" $indexpath]} {
    # puts "not a SUGGESTION ok to reboot"
    # set rebsuggest 1
    } else {
    #puts "is SUGGESTION ok to reboot"
    set rebsuggest 1
    }

    if { $rebrecord == 0 } {
    if { $rebcache == 1 } {
    # puts "can reboot 46"
    } else {
    if { $rebsuggest == 1 } {
    # puts "can reboot 50"
    } else {
    # puts "busy cant reboot 53"
    set count 1
    }
    }
    } else {
    #puts "busy cant reboot 58"
    set count 1
    }

    if { $count == 1 } {
    # puts "NO REBOOT $count"
    } else {
    # puts "REBOOT $count"
    }
    }
    }
    if { $count == 1 } {
    puts "busy, can't reboot"
    #dont reboot
    } else {
    puts "rebooting"
    #reboot
    }

Posting Permissions

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