[Philipp Kern] > *argh* pidofproc returns the pid of the init script -> portmap does > not start at all -> rpc.statd and other NFS daemons do not start. > This affects lenny and severely breaks on-boot mounting of NFS > shares.
Hm, is this the /lib/lsb/init-functions implementation of pidofproc? It seem to be completely useless if it behave as described here. I tested this in etch and unstable. It do not work this way in etch: % cat x #!/bin/sh . /lib/lsb/init-functions pid=`pidofproc x` echo $pid % PATH=.:$PATH x % While in unstabe, the same script return a pid: % PATH=.:$PATH x 18769 % I would say this is a bug in lsb-base. Version 3.1-23.2etch1 work, while 3.2-20 do not. This is the working version: pidofproc () { local pidfile line i pids= status specified pid pidfile= specified= OPTIND=1 while getopts p: opt ; do case "$opt" in p) pidfile="$OPTARG"; specified=1;; esac done shift $(($OPTIND - 1)) if [ -z "${pidfile:-}" ]; then pidfile=/var/run/${1##*/}.pid fi if [ -f "$pidfile" ]; then read pid < "$pidfile" if [ -n "${pid:-}" ]; then if $(kill -0 "${pid:-}" 2> /dev/null); then echo "$pid" return 0 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" = 1 ] && return 3 # program is not running return 0 fi return 4 # program or service is unknown } And this is the diff to the unstable version: @@ -69,25 +71,31 @@ done shift $(($OPTIND - 1)) - if [ -z "${pidfile:-}" ]; then - pidfile=/var/run/${1##*/}.pid + base=${1##*/} + if [ ! "$specified" ]; then + pidfile="/var/run/$base.pid" fi - if [ -f "$pidfile" ]; then + if [ -n "${pidfile:-}" -a -e "$pidfile" ]; then read pid < "$pidfile" if [ -n "${pid:-}" ]; then 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" = 1 ] && return 3 # program is not running + status="0" + /bin/pidof -o %PPID -x $1 || status="$?" + if [ "$status" = 1 ]; then + return 3 # program is not running + fi return 0 fi return 4 # program or service is unknown Happy hacking, -- Petter Reinholdtsen -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]