autofs-5.0.1 - fix pidof init script usage From: Ian Kent <raven@themaw.net> For some reason, following an update, pidof doesn't return the pid of a running automount daemon when the path is used rather than just the name, probably to do with the inode of the daemon program changing. So we change the init script to use just the program name rather than the path. --- redhat/autofs.init.in | 8 ++++---- samples/rc.autofs.in | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) --- autofs-5.0.1.orig/redhat/autofs.init.in +++ autofs-5.0.1/redhat/autofs.init.in @@ -94,14 +94,14 @@ function start() { function stop() { echo -n $"Stopping $prog: " count=0 - while [ -n "`pidof $DAEMON`" -a $count -lt 15 ] ; do + while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do killproc $prog -TERM >& /dev/null RETVAL=$? - [ $RETVAL = 0 -a -z "`pidof $DAEMON`" ] || sleep 3 + [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3 count=`expr $count + 1` done [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/autofs - if [ -n "`pidof $DAEMON`" ] ; then + if [ -n "`pidof $prog`" ] ; then failure "$prog shutdown" else success "$prog shutdown" @@ -121,7 +121,7 @@ function reload() { RETVAL=1 return $RETVAL fi - pid=`pidof $DAEMON` + pid=`pidof $prog` if [ -z $pid ]; then echo $"$prog not running" RETVAL=1 --- autofs-5.0.1.orig/samples/rc.autofs.in +++ autofs-5.0.1/samples/rc.autofs.in @@ -81,13 +81,13 @@ function start() { function stop() { echo -n $"Stopping $prog: " count=0 - while [ -n "`pidof $DAEMON`" -a $count -lt 15 ] ; do + while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do killall -TERM $prog >& /dev/null RETVAL=$? - [ $RETVAL = 0 -a -z "`pidof $DAEMON`" ] || sleep 3 + [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3 count=`expr $count + 1` done - if [ -n "`pidof $DAEMON`" ] ; then + if [ -n "`pidof $prog`" ] ; then echo "done." else echo "failed." @@ -101,7 +101,7 @@ function restart() { } function reload() { - pid=`pidof $DAEMON` + pid=`pidof $prog` if [ -z $pid ]; then echo $"$prog not running" RETVAL=1