DAEMON=/usr/bin/mythtv-status # Introduce the server's location here
NAME=mythtv-status # Introduce the short server's name here
DESC="MythTV Status" # Introduce a short description here
+TEMPFILE=/var/run/motd.mythtv-status
test -x $DAEMON || exit 0
[ -f /var/run/motd ] || touch /var/run/motd
[ -f /var/run/motd.orig ] || cp /var/run/motd /var/run/motd.orig
- cp /var/run/motd.orig /var/run/motd.new
+ if [ -f $TEMPFILE ]; then
+ echo "Hey, $TEMPFILE already exists" 1>&2
+ ls -l /var/run/motd* 1>&2
+ ps -ef | grep mythtv-status 1>&2
+ cat /var/run/motd.new 1>&2
+ fi
+
+ cp /var/run/motd.orig $TEMPFILE
ret=0
- $DAEMON $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null || ret=$?
+ start=$(date)
+ $DAEMON $ARGS -h $HOST >> $TEMPFILE || ret=$?
if [ $ret -eq 0 -o $ret -eq 1 ]; then
- mv /var/run/motd.new /var/run/motd
+ if [ ! -f $TEMPFILE ]; then
+ # My file has gone away. WTF?! Spit out some debugging.
+ echo "Odd, $TEMPFILE has gone away. Start: $date, End: $(date)" 1>&2
+ ls -l /var/run/motd* 1>&2
+ ps -ef | grep mythtv-status 1>&2
+ else
+ mv $TEMPFILE /var/run/motd
+ fi
log_end_msg 0
else
log_failure_msg