Chris- I have attached an updated patch for the status_of_proc() function, that we're currently carrying in Ubuntu.
I have replaced the call to pidofproc() with an invocation of /bin/pidof. It seems that pidofproc() will attempt to call "kill -0" on a pid, if a pidfile is found. This "kill" operation will only succeed if the euid is that of the user owning the daemon, or the root user. Querying the status of a daemon is an operation that should be accessible by non-privileged users. I think this is a reasonable tradeoff. I have tested this with modifications to the init scripts of: (at, bind9, cron, dovecot, openssh-server, samba, sysklogd). It works very well. Additionally, you mentioned the current lenny freeze. This is a very small, compact, standalone function within lsb-base. This change should not affect any existing functionality. Would you reconsider including this under the current freeze? Patches to a number of init scripts are gated upon this functionality being incorporated into lsb-base. Thanks, -- :-Dustin Dustin Kirkland Ubuntu Server Developer Canonical, LTD [EMAIL PROTECTED] GPG: 1024D/83A61194
diff -upr lsb.debian/lsb-3.2/init-functions lsb.ubuntu/lsb-3.2/init-functions --- lsb.debian/lsb-3.2/init-functions 2008-05-01 10:07:37.000000000 -0500 +++ lsb.ubuntu/lsb-3.2/init-functions 2008-07-08 16:42:29.000000000 -0500 @@ -146,6 +146,26 @@ killproc () { return 0 } +# Return LSB status +status_of_proc () { + local daemon name status + 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 + else + log_failure_msg "/bin/pidof not available." + status="1" + 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