LinHES Forums http://forum.linhes.org/ |
|
No more accidental reboots while recording http://forum.linhes.org/viewtopic.php?f=5&t=15334 |
Page 1 of 1 |
Author: | Gnarl [ Wed May 23, 2007 1:25 pm ] |
Post subject: | No more accidental reboots while recording |
In the past I've been burned by forgetting to check what activity is going on in my boxen before rebooting. I was tired of ending up with split show that missed a few minutes. I modified the mythfilldatabase script from imstr8trippin to suit my needs and I thought I would share the script Code: #!/bin/sh I've also created an alias for this to the reboot command to idiot-proof rebooting against myself
# initalize variables db='mythconverg' # substitute the username you want to you use to connect to mySQL user='root' # password variable is here, but I haven't used it password='' # run SQL data0=`mysql $db -u $user -e "select count(*) from inuseprograms where recusage like 'player'" -sN` data1=`mysql $db -u $user -e "select count(*) from inuseprograms where recusage like 'recorder'" -sN` data2=`mysql $db -u $user -e "select count(*) from record \ where inactive=0 and (type!=0 or type!=8) and \ timediff(sysdate(),concat(startdate,' ',starttime))<'00:10:00' and \ timediff(concat(startdate,' ',starttime),sysdate())<'00:10:00';\ " -sN` if [ $data0 -ge 1 -o $data1 -ge 1 -o $data2 -ge 1 ]; then echo -e "\033[31m\n WARNING!!!\033[0m\n" if [ $data0 -ge 1 ]; then echo "MythTV is watching $data0 program(s)" fi if [ $data1 -ge 1 ]; then echo "MythTV is recording $data1 program(s)" fi if [ $data2 -ge 1 ]; then echo "MythTV has scheduled $data2 program(s) within 10 minutes" fi echo -e "\nDo you still wish to reboot? (y/n)" read ANSW case $ANSW in y) reboot ;; *) exit 0 esac else echo "Rebooting" reboot fi exit 0 Edit: Prettied it up |
Author: | averyml [ Thu May 24, 2007 11:21 am ] |
Post subject: | |
You are amazing! I cant' count the number of times I've done the exact same thing. Thank you! |
Author: | Liv2Cod [ Thu May 24, 2007 4:23 pm ] |
Post subject: | |
Looks very cool! Does this go in place of the KnoppMyth shutdown script that is called from the UI? |
Author: | Gnarl [ Thu May 24, 2007 5:27 pm ] |
Post subject: | |
Command line use only for now. You can't answer the prompt from within the frontend |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |