/usr/sbin/mythtv-update-motd is in mythtv-status 0.10.8-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/bin/bash
# Run mythtv-status to update the MOTD.
NAME=mythtv-update-motd
WORKFILE=/var/run/motd
TEMPFILE=/var/run/motd.mythtv-status
. /etc/default/mythtv-status
if [ x$RUN != xyes ]
then
exit
fi
# Debian Wheezy+ handles the MOTD differently.
[ -f /var/run/motd.dynamic ] && WORKFILE=/var/run/motd.dynamic
# Just incase someone has removed their motd file.
[ -f $WORKFILE ] || touch $WORKFILE
[ -f /var/run/motd.orig ] || cp $WORKFILE /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
AGE=$(stat -c "%Z" $TEMPFILE);
if (( $AGE > $(date +'%s') - 900 ))
then
echo "I think another $NAME is running."
exit 1
fi
fi
[ ! -f /var/run/motd.orig ] && cp /var/run/motd /var/run/motd.orig
cp /var/run/motd.orig /var/run/motd.new
ret=0
mythtv-status $ARGS -h $HOST >> $TEMPFILE 2> /dev/null || ret=$?
if [ $ret -eq 0 -o $ret -eq 1 ]; then
if [ ! -f $TEMPFILE ]; then
echo My temporary file has gone away, failed.
exit 1
else
mv $TEMPFILE $WORKFILE
fi
else
# Something else went wrong, remove the temp file.
rm $TEMPFILE
exit 1
fi
|