[mythtv-users] HDPVR Kernel module reload as power cycle
Steven Adeff
adeffs.mythtv at gmail.com
Sat Dec 8 16:56:35 UTC 2012
On Sat, Dec 8, 2012 at 11:29 AM, Steven Adeff <adeffs.mythtv at gmail.com> wrote:
> On Sat, Dec 8, 2012 at 11:24 AM, David Asher <david at teamasher.net> wrote:
>> <stuff removed>
>>
>> I think you meant to compare STATUS to "1" (or ne "2"). Your loop sets STATUS to "2" when an HD-PVR is recording.
>>
>> David.
>
> yea, and I also noticed it won't respond properly for livetv. posted
> too early... will have a revised version shortly!
found another bug with assigning variables in while loops I had to fix...
------------
#!/bin/bash
#export PATH=/usr/bin
logfile=/var/log/mythtv/hdpvr_powercycle.log
exec >> $logfile 2>&1
echo "Checking PVR status at " `date`
## mythweb url, should work as long as the script is being run on the same
## system as mythweb and apache
MYTHWEBURL=http://localhost/mythweb/status
## if your mythweb is password protected enter your username and password here
MYTHWEBUSER=
MYTHWEBPASSWORD=
## to limit the time the script will run, place your hour limits here
## in 24h format (ie 1pm=13)
MINHR=2
MAXHR=6
## don't touch these!
STATUS=1
TIME=`date +%H`
TODAY=`date +%F`
## Let's start!
echo "Hour: " $TIME
if [ "$TIME" -ge "$MINHR" -a "$TIME" -lt "$MAXHR" ]
then
echo "Clear to run at this time!"
wget -O - --quiet --user=$MYTHWEBUSER --password=$MYTHWEBPASSWORD
$MYTHWEBURL | grep HDPVR | \
while read line
do
device=`echo $line | sed -e 's/.*Encoder \([0-9]\).*/\1/'`
if `echo $line | grep --quiet 'and is not'`
then
echo "HDPVR ${device} is not being used"
else
echo "however, HDPVR ${device} is busy, we will wait"
exit 2
fi
done
STATUS=$?
if [ "$STATUS" -eq "1" ]
then
echo "no devices are in use!"
echo "reloading driver for HDPVR devices..."
/usr/local/bin/hdpvr_powercycle.sh
else
echo "an HDPVR is in use, we won't reload at this time"
fi
else
echo "Wrong time! We won't run now..."
fi
-------
I've created this wiki page,
http://www.mythtv.org/wiki/HD-PVR_Power_Cycle_by_Module_Reload
--
Steve
http://www.mythtv.org/wiki/User:Steveadeff
Before you ask, read the FAQ!
http://www.mythtv.org/wiki/Frequently_Asked_Questions
then search the Wiki, and this list,
http://www.gossamer-threads.com/lists/mythtv/
Mailinglist etiquette - http://www.mythtv.org/wiki/Mailing_List_etiquette
More information about the mythtv-users
mailing list