Skip to contentSkip to conversation

PATCH: autofs initscript: SuSE

PATCH Christian Vogel 1 participant 1 message Dec 30, 2003 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi,

I changed the autofs init script supplied with 4.1.0 to work with SuSE (V7.2 tested). SuSE has /sbin/startproc and /sbin/killproc to start and stop daemons. I could not use startproc because startproc tries to avoid having duplicate processes running (/usr/sbin/automount), and if you have several automounters running, this is not what you want. killproc behaves correctly as long as we provide the correct pidfile (does not work with startproc, I tried).

Chris

12/30 11:11:08 renamed from 12/29 14:08:46 1.1 +37 -0
@@ -41,6 +41,8 @@
     system=debian
 elif [ -f /etc/redhat-release ]; then
     system=redhat
+elif [ -f /etc/SuSE-release ] ; then
+    system=SuSE
 else
     echo "$0: Unknown system, please port and contact [email protected]" 1>&2
     exit 1
@@ -402,11 +404,46 @@
 esac
 }
 
+function SuSE()
+{
+       case "$1" in
+               start)
+                       echo -n "Starting automounter: "
+                       getmounts | while read cmd mnt rest
+                       do
+                               echo -n " $mnt"
+                               pidfile=/var/run/autofs${mnt//\//.}.pid
+
+                               $DAEMON -p $pidfile \
+                                       $daemonoptions -- $mnt $rest
+
+                       done
+                       echo " ."
+               ;;
+               stop)
+                       echo -n "Stopping automounter:"
+                       getmounts | while read cmd mnt rest
+                       do
+                               echo -n " $mnt"
+                               pidfile=/var/run/autofs${mnt//\//.}.pid
+                               killproc -p $pidfile $DAEMON
+                       done
+                       echo " ."
+               ;;
+               *)
+                       echo "Usage: $0 start|stop" >&2
+                       exit 1
+               ;;
+       esac
+}
+
 RETVAL=0
 if [ $system = debian ]; then
        debian "$@"
 elif [ $system = redhat ]; then
        redhat "$@"
+elif [ $system = SuSE ] ; then
+       SuSE "$@"
 fi
 
 exit $RETVAL