On Wed, 2008-07-09 at 16:24 -0500, Chris Lawrence wrote: > Is this the right patch? It appears to be relative to 3.2-12 (or > earlier), not 3.2-13.
This one is against 3.2-13. Sorry about that! I changed the way status_of_proc() supports pidfiles, to match the "-p $pidfile" syntax used elsewhere for the sake of consistency. -- :-Dustin Dustin Kirkland Ubuntu Server Developer Canonical, LTD [EMAIL PROTECTED] GPG: 1024D/83A61194
diff -upr lsb.debian/lsb-3.2/init-functions lsb/lsb-3.2/init-functions --- lsb.debian/lsb-3.2/init-functions 2008-07-08 22:00:08.000000000 -0500 +++ lsb/lsb-3.2/init-functions 2008-07-09 16:55:04.000000000 -0500 @@ -81,14 +81,17 @@ pidofproc () { if $(kill -0 "${pid:-}" 2> /dev/null); then echo "$pid" return 0 + elif ps "${pid:-}" >/dev/null 2>&1; then + echo "$pid" + return 0 # program is running, but not owned by this user else return 1 # program is dead and /var/run pid file exists fi fi fi if [ -x /bin/pidof -a ! "$specified" ]; then - /bin/pidof -o %PPID $1 - status="$?" + status="0" + /bin/pidof -o %PPID $1 || status="$?" if [ "$status" = 1 ]; then return 3 # program is not running fi @@ -137,7 +140,7 @@ killproc () { if [ -n "$sig" ]; then return 0 fi - return 0 # program is not running + return 3 # program is not running fi if [ "$status" = 0 -a "$is_term_sig" = yes ]; then @@ -148,22 +151,32 @@ killproc () { # Return LSB status status_of_proc () { - local daemon name status + local pidfile daemon name status + + pidfile= + OPTIND=1 + while getopts p: opt ; do + case "$opt" in + p) pidfile="$OPTARG";; + esac + done + shift $(($OPTIND - 1)) + + if [ -n "$pidfile" ]; then + pidfile="-p $pidfile" + fi daemon="$1" name="$2" + status="0" - if [ -x /bin/pidof ]; then - /bin/pidof -o %PPID "$daemon" >/dev/null || status="$?" - if [ "$status" = 0 ]; then - log_success_msg "$name is running." - else - log_failure_msg "$name is not running." - fi + pidofproc $pidfile $daemon >/dev/null || status="$?" + if [ "$status" = 0 ]; then + log_success_msg "$name is running." + return 0 else - log_failure_msg "/bin/pidof not available." - status="1" + log_failure_msg "$name is not running." + return $status fi - return "$status" } log_use_fancy_output () {
signature.asc
Description: This is a digitally signed message part