[mythtv-users] FC4/Atrpms 0.19 - losing track of upcoming recordings; watchdog script

Peter Watkins peterw at tux.org
Sat May 6 14:17:21 EDT 2006


This has happened to me about four times now over the last couple months
-- the backend suddenly "forgets" all upcoming recording schedules.
Restarting the backend restores the schedule, but if I don't catch it in
time, I can easily miss scheduled recordings.

This is a FE+BE setup based on ATrpms and Jarod's instructions. MySQL is
the Fedora-provided mysql-4.1.16-1.FC4.1 package, so this is not a MySQL
5.x issue. /etc/my.cnf is unchanged from the Fedora package. I've had
the BE go weeks without a problem, and I've had it forget with only a
few days of uptime, FWIW.

I missed two shows due to this last case of amnesia, so I finally got
off my tailbone and wrote a shell script that uses 'wget' and MythWeb to
check the list of upcoming recordings and stop/sleep/start the BE if the
list of upcoming recordings is empty or unusually short.

Maybe the changes in SVN to accommodate the MySQL 5.x connection loss
would also take care of my problem, but this is my only PVR system and I
have limited opportunities for downtime & system hacking. I'm including
my check/restart script for anyone else who might have interest.

-Peter


#!/bin/sh
#
# restart mythtv if it loses the upcoming recordings schedule

DATADIR=/path/to/dir		# directory to safely store work files
WEBUSER=someuser                # username fo HTTP auth
WEBPASSWD=somepasswd   		# password for HTTP auth
WEBSITE=http://localhost        # base URL of MythWeb HTTP server
NOTIFY=root                     # email address to notify of restarts
FLAGFILE=${DATADIR}/upcoming.flag	# updated if BE restarted
TESTFILE=${DATADIR}/upcoming.wget.out
WGETLOGFILE=${DATADIR}/upcoming.wget.log

wget --output-document=${TESTFILE} -o ${WGETLOGFILE} \
  --user=${WEBUSER} --password=${WEBPASSWD} \
  ${WEBSITE}/mythweb/tv/upcoming

egrep '(Never Record|Forget Old)' $TESTFILE > ${DATADIR}/shows
showcount=`wc -l < ${DATADIR}/shows`
#echo "We seem to have $showcount upcoming shows"

# I usually have dozens of shows listed; 5 seems a decent mininum
if [ $showcount -lt 5 ]; then
  touch $FLAGFILE
  date=`date`
  /etc/init.d/mythbackend stop
  sleep 5
  /etc/init.d/mythbackend start
  echo "restarted mythbackend at $date" | mail -s \
    "mythbackend restart $date" ${NOTFIY}
fi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20060506/6075556e/attachment-0001.pgp 


More information about the mythtv-users mailing list