[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Fwd: "status" function for init scripts]



Howdy,

Onno Benschop and I create the attached patch to provide a generic
status_of_proc() function to the LSB initscripts header script of
functions.

We would appreciate a careful review and inclusion of the patch below
into Debian's LSB functions.

Thanks,
-- 
:-Dustin

Dustin Kirkland
Ubuntu Server Developer
Canonical, LTD
kirkland@canonical.com
GPG: 1024D/83A61194
--- Begin Message ---
Hi Chris,

Dustin Kirkland and I have been working on a bug that fixes an issue
where the status function [1] is missing in many init.d scripts [2].

We're proposing the attached patch, a common function that can be used
to gather status for *most* init scripts that use the lsb-functions.

Assuming you can accept this or a modified version of this patch, we
have patches for a number of common services' init scripts which would
use this function.  As such, those patches actually depend on this one
to the lsb package.

Please advise.

Thanks,
Onno Benschop
Dustin Kirkland


[1]
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
[2] https://bugs.launchpad.net/ubuntu/+source/at/+bug/203169
[3] apache2, at, bind9, cron, dovecot, openssh, samba, sysklogd, udev
diff -ruN lsb-3.1.orig/debian/changelog lsb-3.1/debian/changelog
--- lsb-3.1.orig/debian/changelog	2008-01-24 00:46:49.000000000 +0900
+++ lsb-3.1/debian/changelog	2008-03-18 08:18:58.000000000 +0900
@@ -1,3 +1,10 @@
+lsb (3.1-24ubuntu3) hardy; urgency=low
+
+  * init-functions: Added support function for LSB status compliance 
+    (LP: #203169), coded with Dustin Kirkland <kirkland@ubuntu.com>
+
+ -- Onno Benschop <onno@itmaze.com.au>  Thu, 13 Mar 2008 19:30:54 +0900
+
 lsb (3.1-24ubuntu2) hardy; urgency=low
 
   * lsb-cxx: Drop dependency on libstdc++5, not needed by LSB-3.1.
diff -ruN lsb-3.1.orig/init-functions lsb-3.1/init-functions
--- lsb-3.1.orig/init-functions	2007-10-05 04:15:15.000000000 +0800
+++ lsb-3.1/init-functions	2008-03-13 19:30:42.000000000 +0900
@@ -132,6 +132,21 @@
     return 0
 }
 
+# Return LSB status
+status_of_proc () {
+    local daemon name status
+    daemon="$1"
+    name="$2"
+    pidofproc $daemon >/dev/null
+    status=$?
+    if [ $status -eq 0 ]; then
+        log_success_msg "$name is running."
+    else
+        log_failure_msg "$name is not running."
+    fi
+    return $status
+}
+
 log_use_fancy_output () {
     TPUT=/usr/bin/tput
     EXPR=/usr/bin/expr

--- End Message ---

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: