The /etc/init.d/autofs script uses the wrong parameter when generating the pid file in start(). This prevents multiple maps with the same --timeout option being loaded. In /var/run the pid file is created as autofs.<timeout value>.pid not autofs.<mount point>.pid as desired. In stats() the script looks for automount rather than /usr/sbin/automount in the process list. Reproducible: Always Steps to Reproduce: 1. Create multiple maps e.g auto.home and auto.misc with the same timeout. 2. Restart autofs, only one autofs daemon is started for the first map 3. Actual Results: Only one autofs daemon started for each unique timeout value in start() The configured daemons but not the running daemons are reported in stats() Expected Results: Started a daemon for each autofs map in start() Report the running as well as the configured daemons in stats() I have modified the init script and its behaviour now seems to be as expected. This has beem tested with two yp and one file maps. Patch below: root@wraith [init.d]$ diff -u autofs.orig autofs --- autofs.orig 2003-02-15 13:39:23.000000000 +0000 +++ autofs 2003-02-15 11:04:45.000000000 +0000 @@ -135,29 +135,31 @@ start() { ebegin "Starting automounter" - getmounts | while read cmd timeout mnt rest + getmounts | while read cmd timeout time mnt rest do #FIXME: this works but it really sucks if echo $timeout|grep -v -- '--timeout' >/dev/null ; then - rest="$mnt $rest" + rest="$time $mnt $rest" mnt="$timeout" + time="" timeout="" fi echo -n " $mnt" pidfile=/var/run/autofs`echo $mnt | sed 's/\//./g'`.pid start-stop-daemon --start --pidfile $pidfile --quiet \ - --exec /usr/sbin/automount -- $timeout $mnt $rest + --exec /usr/sbin/automount -- $timeout $time $mnt $rest # # Automount needs a '--pidfile' or '-p' option. # For now we look for the pid ourself. # - ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout \?$mnt" | ( + ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout $time \?$mnt" | ( read pid rest echo $pid > $pidfile echo "$mnt $rest" >> $pidfile ) done + echo eend $? } @@ -174,7 +176,7 @@ echo "" echo "Active Mount Points:" echo "--------------------" - ps ax|grep "[0-9]:[0-9][0-9] automount " | ( + ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | ( while read pid tt stat time command; do echo $command; done ) }
Created attachment 8299 [details, diff] Patch for /etc/init.d/autofs
Comment on attachment 8299 [details, diff] Patch for /etc/init.d/autofs --- autofs.orig 2003-02-15 13:39:23.000000000 +0000 +++ autofs 2003-02-15 11:04:45.000000000 +0000 @@ -135,29 +135,31 @@ start() { ebegin "Starting automounter" - getmounts | while read cmd timeout mnt rest + getmounts | while read cmd timeout time mnt rest do #FIXME: this works but it really sucks if echo $timeout|grep -v -- '--timeout' >/dev/null ; then - rest="$mnt $rest" + rest="$time $mnt $rest" mnt="$timeout" + time="" timeout="" fi echo -n " $mnt" pidfile=/var/run/autofs`echo $mnt | sed 's/\//./g'`.pid start-stop-daemon --start --pidfile $pidfile --quiet \ - --exec /usr/sbin/automount -- $timeout $mnt $rest + --exec /usr/sbin/automount -- $timeout $time $mnt $rest # # Automount needs a '--pidfile' or '-p' option. # For now we look for the pid ourself. # - ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout \?$mnt" | ( + ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout $time \?$mnt" | ( read pid rest echo $pid > $pidfile echo "$mnt $rest" >> $pidfile ) done + echo eend $? } @@ -174,7 +176,7 @@ echo "" echo "Active Mount Points:" echo "--------------------" - ps ax|grep "[0-9]:[0-9][0-9] automount " | ( + ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | ( while read pid tt stat time command; do echo $command; done ) }
ok added, thanks