+2018-12-31 Andrew Ruthven
+ Ship a systemd service file which correctly starts and stops the motd
+ update services. As part of this change, if you use systemd or sysvinit
+ to stop mythtv-status it will stop updating the motd snippet via cron.
+
2018-12-30 Andrew Ruthven
Modify mythtv-update-motd to look to see if /etc/update-motd.d is
present, if it is, then generate MOTD content in a compatible fashion.
. /etc/default/mythtv-status
-if [ x$RUN != xyes ]
+if [ x$RUN != xyes -o -f /var/lib/mythtv-status/motd_update_disabled ]
then
exit
fi
* New upstream release (Closes: #853857).
* Install a snippet into /etc/update-motd.d (Closes: #902684).
* Update standards version to 4.3.0.
+ * Ship a systemd service file (Closes: #772801)
-- Andrew Ruthven <andrew@etc.gen.nz> Mon, 12 Nov 2018 23:19:17 +1300
usr/bin
+var/lib/mythtv-status
DESC="MythTV Status" # Introduce a short description here
TEMPFILE=/var/run/motd.mythtv-status
WORKFILE=/var/run/motd
+DISABLED_FLAG=/var/lib/mythtv-status/motd_update_disabled
test -x $DAEMON || exit 0
start|reload|refresh|restart|force-reload)
log_daemon_msg "Updating $DESC" "$NAME"
+ rm $DISABLED_FLAG
if ! /usr/sbin/mythtv-update-motd; then
log_failure_msg "Failed to update MOTD"
exit 1
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
+ touch $DISABLED_FLAG
[ -f /var/run/motd.orig ] && cp /var/run/motd.orig $WORKFILE
rm /var/run/motd.orig 2> /dev/null || true
rm $TEMPFILE 2> /dev/null || true
log_end_msg 0
;;
status)
+ if [ -f $DISABLED_FLAG ]; then
+ log_failed "$NAME is not running (disabled by flag file: $DISABLED_FLAG)"
+ exit 1
+ fi
if [ ! -f $WORKFILE ]; then
log_failure_msg "$NAME is not running (no motd file)!"
exit 1
--- /dev/null
+[Unit]
+Description=MythTV Status
+After=network.target mythtv-backend.service
+Wants=mythtv-backend.service
+Documentation=man:mythtv-status
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/bin/sh -c "rm /var/lib/mythtv-status/motd_update_disabled || true"
+ExecStart=/usr/sbin/mythtv-update-motd
+ExecStop=/bin/sh -c "touch /var/lib/mythtv-status/motd_update_disabled; rm /run/motd.mythtv-status || true";
+
+[Install]
+WantedBy=multi-user.target
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH MYTHTV-UPDATE-MOTD 1 "2015-01-11"
+.TH MYTHTV-UPDATE-MOTD 1 "2018-12-31"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
-mythtv-update-motd \- update the MOTD with the MythTV backend status
+mythtv-update-motd \- update the MOTD with a MythTV backend status
.SH SYNOPSIS
.B mythtv-update-motd
.SH DESCRIPTION
-.B mythtv-update-motd
-Update the system MOTD with the status of the MythTV backend.
-It checks the host which is configured in
+Update the system MOTD with the status of a MythTV backend. It is
+typically run from cron.
+.SH CONFIGURATION
+The configuration file for this script is
.I /etc/default/mythtv-status
-with the HOST setting.
+options of interest:
+.TP
+.B HOST
+The host to check, by default this is localhost.
+.TP
+.B RUN
+Should this script run? Set to yes to enable, anything else to disable.
+.PP
+.PD 0
+You can also disable this script from running by creating a file
+called
+.IR /var/lib/mythtv-status/motd_update_disabled .
+If you run either:
+.IP
+systemctl stop mythtv-status
+.PP
+or
+.IP
+/etc/init.d/mythtv-status stop
+.PP
+this will be done for you, and will remove the most recent motd snippet.
+.PD
.SH OPTIONS
None
.SH "EXIT STATUS"