From b54b5a807bf86b851a251b30f258a67dfd7cd1c7 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sun, 23 Nov 2008 14:41:33 +1300 Subject: [PATCH] Add a status to the init.d script. Also remove /var/run/motd.orig when we're stopped, try and be tidy Kiwi's. --- debian/changelog | 3 ++- debian/init.d | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3837fe0..3497ec1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ mythtv-status (0.9.0-6) unstable; urgency=low - + Swedish debconf translation from Martin Bagge (Closes: #506599). + * Swedish debconf translation from Martin Bagge (Closes: #506599). + * Add a status to the init.d file. -- Andrew Ruthven Sun, 23 Nov 2008 13:29:52 +1300 diff --git a/debian/init.d b/debian/init.d index 3274b13..1755382 100644 --- a/debian/init.d +++ b/debian/init.d @@ -76,11 +76,31 @@ case "$1" in stop) log_daemon_msg "Stopping $DESC" "$NAME" [ -f /var/run/motd.orig ] && cp /var/run/motd.orig /var/run/motd + rm /var/run/motd.orig log_end_msg 0 ;; + status) + if [ ! -f /var/run/motd.orig ]; then + log_failure_msg "$NAME is not running" + exit 1 + fi + if [ ! -f /var/run/motd ]; then + log_failure_msg "$NAME is not running (no motd file!)" + exit 1 + fi + if [ $(date -d "15 minutes ago" +"%s") -gt $(stat -c "%Y" /var/run/motd) ] + then + log_failure_msg "$NAME is not running (motd file is stale)" + exit 1 + fi + + # If all tests have passed, then we must be running. + log_success_msg "$NAME is running" + exit 0 + ;; *) N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|reload|refresh}" >&2 + echo "Usage: $N {start|stop|reload|refresh|status}" >&2 exit 1 ;; esac -- 2.30.2