Package: am-utils
Version: 6.2+rc20110530-3
Severity: wishlist

patch below, based on what the postfix initrc does, in case it's useful

It introduces a dependency on package lsb-base (>=2.0-7) || lsb (>=1.0.1-11)
(being versions i could readily discern from sources.d.n), note, and uses
the functions log_success_msg and log_failure_msg that the README of lsb
(now) says ``*do not* comply with Debian policy and should only be used by
LSB packages'', so ... not sure this isn't asking for trouble, but the
postfix initrc does it, so ...  not sure what the politically correct
alternative is when status_of_proc can't be used

Also changes the usage message from /etc/init.d/amd to /etc/init.d/am-utils

--buck

--- /etc/init.d/am-utils.orig   2014-04-07 15:58:17.000000000 -0400
+++ /etc/init.d/am-utils        2015-04-22 11:38:12.480142000 -0400
@@ -21,6 +21,8 @@
 PATH=/usr/sbin:/sbin:/usr/bin:/bin
 export PATH
 
+. /lib/lsb/init-functions
+
 # Defaults
 CONF=/etc/default/am-utils
 
@@ -84,8 +86,12 @@ get_amd_args() {
 
 }
 
+pid_of_amd() {
+    amq -p 2>/dev/null
+}
+
 start_amd() {
-    pid="`amq -p 2>/dev/null`"
+    pid=`pid_of_amd`
     if [ -n "$pid" ]; then
        echo "Starting automounter: amd is already running" 1>&2
        exit 0
@@ -151,7 +157,7 @@ raze_amd() {
 }
 
 stop_amd() {
-    pid="`amq -p 2>/dev/null`"
+    pid=`pid_of_amd`
     if [ -z "$pid" ]; then
        echo "Stopping automounter: amd not running" 1>&2
        if [ $# -eq 0 ]
@@ -208,8 +214,20 @@ case "$1" in
        # amd tests itself if its map files have changed, so nothing to do here
        ;;
 
+  status)
+       pid=`pid_of_amd`
+       if [ -n "$pid" ]; then
+          log_success_msg "am-utils is running"
+          exit 0
+       else
+          log_success_msg "am-utils is not running" # , i guess
+          exit 3
+       fi
+       ;;
+
+
   *)
-       echo "Usage: /etc/init.d/amd {start|stop|restart|[force-]reload}"
+       echo "Usage: /etc/init.d/am-utils 
{start|stop|restart|[force-]reload|status}"
        exit 1
 esac
 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to