Difference between revisions of "MythTV"
From Blue-IT.org Wiki
(→Cron) |
(→Check for shutdown) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Cron == | == Cron == | ||
0,15,30,45 * * * * mythtv /home/mythtv/tvm2vdr/tvm2xml_auto.sh | 0,15,30,45 * * * * mythtv /home/mythtv/tvm2vdr/tvm2xml_auto.sh |
Revision as of 12:49, 3 October 2010
Contents
Cron
0,15,30,45 * * * * mythtv /home/mythtv/tvm2vdr/tvm2xml_auto.sh 5,20,35,50 * * * * mythtv /home/mythtv/tvm2vdr/mythfilldatabase_auto.sh 0,5,10,15,20,25,30,35,40,45,50,55 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * root /bin/bash /root/bin/set_wakeuptime_via_mythshutdown.sh
Setting the acpi wakeuptime manually via script
There are problems with setting the wakeuptime of my pc via the buildin mythtv functionality. I really don't know why. If set the wakeuptime manually in acpi, it works. So I made this script, which runs every five minutes (see Cron):
It comes in two parts
set_wakeuptime_via_mythshutdown.sh
Extracts the string for the next wakeuptime out of the mythshutdown command:
#!/bin/bash echo "MYTH WAKEUP ----------------------------------" SHUTDOWN="$(mythshutdown -t -v timestamp | grep "wakeup time given" | cut -d " " -f 8 | sed -e 's/T/ /')" echo $SHUTDOWN /root/bin/set_wakeuptime.sh "$(date --date "${SHUTDOWN}" '+%s')" echo "RTC ----------------------------------" cat /proc/driver/rtc echo "WAKEALARM ----------------------------------" cat /sys/class/rtc/rtc0/wakealarm
set_wakeuptime.sh
#!/bin/bash #$1 is the first argument to the script. It is the time in seconds since 1970 #this is defined in mythtv-setup with the time_t argument echo 0 > /sys/class/rtc/rtc0/wakealarm #this clears your alarm. echo "$1" > /sys/class/rtc/rtc0/wakealarm #this writes your alarm. echo "$(cat /proc/driver/rtc)"
Shutdown check
#!/bin/bash # # MythShutdownCheck # # checks to see if any other user is # logged in before idle shutdown # # returns "1" if yes, stopping shutdown # returns "0" if ok to shutdown # reset() { echo Resetting mythtv shutdown timer. Going on ... exit 1 } ready() { echo System ready for shutdown. exit 0 } echo This is script $0. echo ... checking users logged in. #if last | head | grep -q "tty/.*still logged in" # check for active *remote* login? #if last | grep still | grep :0 # check for active *graphical* login? #if false # FOR TESTING ONLY WHEN LOGGED IN if last | grep still | grep -v ":0" # check for active *ANY* login? then echo ... some users are logged in ... continuing. reset else echo ... checking for tv_grab_de_prisma process if ps x -u mythtv | grep -v grep | grep tvm2xml_auto.sh then echo tvm2xml_auto process is still running ... continuing. reset else if ps xa | grep -v grep | grep /root/bin/rsync_vserver.sh then echo vserver backup is running ... continuing. reset else if ps xa | grep -v grep | grep rhythmbox then echo rhythmbox is running ... continuing. reset else if ps xa | grep -v grep | grep firefox-bin then echo firefox ist running ... continuing. reset else if [ "$(cat status | grep status | cut -d"=" -f2)" == "stopped" ] then echo radio applet is running ... continuing. reset else ## READY FOR SHUTDOWN ###### ready ############################ fi fi fi fi fi fi