Mythshutdown

From MythTV Official Wiki
Revision as of 10:03, 4 March 2010 by TMonster (Talk | contribs)

Jump to: navigation, search

Incomplete.png Incomplete, needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page

Using Mythshutdown to block shutdown

Mythshutdown can be used to block an automatic shutdown. Since 0.21 it is possible to call mythshutdown --lock from each script so that shutdown will remain blocked until the last script has terminated and called mythshutdown --unlock.


Script.png script.sh
#!/bin/bash
# Unlock if the script is terminated for any reason
trap "/usr/local/bin/mythshutdown --unlock" 0 SIGHUP SIGINT SIGQUIT SIGABRT SIGKILL SIGALRM SIGSEGV SIGTERM

# Lock shutdown
/usr/local/bin/mythshutdown --lock

# Do script stuff


The full command-line options are (taken from version 0.22 output):

Script.png mythshutdown --help
-w/--setwakeup time      (sets the wakeup time. time=yyyy-MM-ddThh:mm:ss
                          doesn't write it into nvram)
-t/--setscheduledwakeup  (sets the wakeup time to the next scheduled recording)
-q/--shutdown            (set nvram-wakeup time and shutdown)
-x/--safeshutdown        (equal to -c -t -q.  check shutdown possible, set
                           scheduled wakeup and shutdown)
-p/--startup             (check startup. check will return 0 if automatic
                                                           1 for manually)
-c/--check flag          (check shutdown possible
                          flag is 0 - don't check recording status
                                  1 - do check recording status (default)
                          returns 0 ok to shutdown
                                  1 reset idle check)
-l/--lock                (disable shutdown. check will return 1.)
-u/--unlock              (enable shutdown. check will return 0)
-s/--status flag         (returns a code indicating the current status)
                          flag is 0 - don't check recording status
                                  1 - do check recording status (default)
                          0 - Idle
                          1 - Transcoding
                          2 - Commercial Flagging
                          4 - Grabbing EPG data
                          8 - Recording - only valid if flag is 1
                         16 - Locked
                         32 - Jobs running or pending
                         64 - In a daily wakeup/shutdown period
                        128 - Less than 15 minutes to next wakeup period
                        255 - Setup is running
-v/--verbose debug-level (Use '-v help' for level info
-h/--help                (shows this usage)


See, also, Mythwelcome.