Package: lsb-base Version: 3.2-4 Severity: wishlist Tags: patch The Linux Standard Base init script specification: http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html describes the status action in detail. In brief, it provides a centralized and direct way of determining if a given service is running or not, with a bit more sophistication than grepping a process listing. It logs a message to standard output, and exits with one of a number of meaningful codes, also defined in the LSB specification.
This has been discussed in a round-about way in a couple of bugs against debian-policy before: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291148 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208010 More recently, we posted this patch to the debian-lsb mailing-list: http://lists.debian.org/debian-lsb/2008/05/msg00000.html We're filing a bug here against lsb-base in hopes of having the attached patch accepted into the lsb-base package. We suggest adding a function, status_of_proc(), to /lib/lsb/init-functions, which is already sourced by most scripts in /etc/init.d. The heavy lifting is performed by the pidofproc() function, which is already defined in that same file. +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 +} This addition would be followed by a series of patches to various init scripts essentially adding the following to the case handler: + status) + status_of_proc "$DAEMON" "$NAME" + exit $? + ;; -- :-Dustin Dustin Kirkland Ubuntu Server Developer Canonical, LTD [EMAIL PROTECTED] GPG: 1024D/83A61194 -- System Information: Debian Release: lenny/sid APT prefers hardy-updates APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy') Architecture: amd64 (x86_64) Kernel: Linux 2.6.24-17-generic (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages lsb-base depends on: ii libncurses5 5.6+20071124-1ubuntu2 Shared libraries for terminal hand ii libpam0g 0.99.7.1-5ubuntu6.1 Pluggable Authentication Modules l ii ncurses-bin 5.6+20071124-1ubuntu2 Terminal-related programs and man ii sed 4.1.5-5 The GNU sed stream editor lsb-base recommends no packages. -- no debconf information
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
signature.asc
Description: This is a digitally signed message part

