Source: dnet-progs
Version: 2.57
Severity: wishlist
Tags: patch

Here is a patch to add support for the "status" action to the init.d
scripts of dnprogs.  In dnet-progs, I made it so that it accumulates
the status of the individual daemons.  For dnet-common, I made it a
noop because most of the other actions also do nothing, so the status
could be considered always "OK".  I also changed it so that the exit
status of the init scripts when given an invalid action are nonzero,
as recommended by /etc/init.d/skeleton.
diff -Nru dnprogs-2.57/debian/changelog dnprogs-2.57+nmu1/debian/changelog
--- dnprogs-2.57/debian/changelog	2011-09-08 17:20:32.000000000 +0300
+++ dnprogs-2.57+nmu1/debian/changelog	2011-12-10 19:05:12.000000000 +0200
@@ -1,3 +1,9 @@
+dnprogs (2.57+nmu1) UNRELEASED; urgency=low
+
+  * Added support for "status" action to init.d scripts
+
+ -- Peter Eisentraut <[email protected]>  Sat, 10 Dec 2011 19:04:44 +0200
+
 dnprogs (2.57) unstable; urgency=medium
 
   [ Chrissie Caulfield ]
diff -Nru dnprogs-2.57/debian/control dnprogs-2.57+nmu1/debian/control
--- dnprogs-2.57/debian/control	2011-09-08 17:18:55.000000000 +0300
+++ dnprogs-2.57+nmu1/debian/control	2011-12-11 00:29:21.000000000 +0200
@@ -24,7 +24,7 @@
 
 Package: dnet-progs
 Architecture: any
-Depends: dnet-common(>=${binary:Version}), libdnet(>=${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends: dnet-common(>=${binary:Version}), libdnet(>=${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, lsb-base
 Description: DECnet user programs and daemons
  These tools are the application layer interface for DECnet on Linux systems.
  They provide file/terminal access facilities between OpenVMS and Linux and
diff -Nru dnprogs-2.57/debian/dnet-common.init.d dnprogs-2.57+nmu1/debian/dnet-common.init.d
--- dnprogs-2.57/debian/dnet-common.init.d	2010-04-29 11:05:18.000000000 +0300
+++ dnprogs-2.57+nmu1/debian/dnet-common.init.d	2011-12-10 19:04:37.000000000 +0200
@@ -99,11 +99,12 @@
      set_routing 0
      ;;
 
-   restart|reload|force-reload)
+   status|restart|reload|force-reload)
      ;;
 
    *)
-     echo "Usage $0 {start|stop|restart|reload|force-reload}"
+     echo "Usage $0 {start|stop|status|restart|reload|force-reload}"
+     exit 3
      ;;
 esac
 
diff -Nru dnprogs-2.57/debian/dnet-progs.init.d dnprogs-2.57+nmu1/debian/dnet-progs.init.d
--- dnprogs-2.57/debian/dnet-progs.init.d	2010-04-29 11:05:18.000000000 +0300
+++ dnprogs-2.57+nmu1/debian/dnet-progs.init.d	2011-12-11 00:25:16.000000000 +0200
@@ -31,6 +31,8 @@
   exit 0
 fi
 
+. /lib/lsb/init-functions
+
 case $1 in
    start)
 
@@ -58,6 +60,19 @@
      echo "."
      ;;
 
+   status)
+     ret=0
+     for i in $DNET_DAEMONS
+     do
+       status_of_proc /usr/sbin/$i $i
+       status=$?
+       if [ $status -gt $ret ]; then
+         ret=$status
+       fi
+     done
+     exit $ret
+     ;;
+
    # DECnet daemons all automatically reconfigure.
    reload)
      ;;
@@ -75,7 +90,8 @@
      ;;
 
    *)
-     echo "Usage $0 {start|stop|restart|reload|force-reload}"
+     echo "Usage $0 {start|stop|restart|status|reload|force-reload}"
+     exit 3
      ;;
 esac
 

Reply via email to