+mythtv-status (0.10.2-2) unstable; urgency=low
+
+ * Handle a stale temp file more gracefully (Closes: #681684)
+
+ -- Andrew Ruthven <andrew@etc.gen.nz> Tue, 02 Oct 2012 21:48:01 +1300
+
mythtv-status (0.10.2-1) unstable; urgency=low
* New upstream release. (Closes: #680358)
[ -f /var/run/motd ] || touch /var/run/motd
[ -f /var/run/motd.orig ] || cp /var/run/motd /var/run/motd.orig
+ # If the tempfile is less than 15 minutes old, object, otherwise
+ # we'll assume that something went wrong and remove it.
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
+ AGE=$(stat -c "%Z" $TEMPFILE);
+ if expr $AGE \> $(date +'%s') - 900
+ then
+ log_warning_msg "I think another $NAME is running."
+ exit 1
+ fi
fi
cp /var/run/motd.orig $TEMPFILE
$DAEMON $ARGS -h $HOST >> $TEMPFILE || ret=$?
if [ $ret -eq 0 -o $ret -eq 1 ]; then
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
+ log_failure_msg "My temporary file has gone away, failed."
+ exit 1
else
mv $TEMPFILE /var/run/motd
fi