]> git.pld-linux.org Git - packages/autofs.git/blobdiff - autofs.init
Standarized all rc scripts.
[packages/autofs.git] / autofs.init
index 0d475599dad9ded44fb9b95ee290d10d0c5c4207..09e4dcfad00938331dae0408743f6ba97e706904 100644 (file)
@@ -1,29 +1,31 @@
-#!/bin/bash
+#!/bin/sh
 #
-#       $Id$
+# autofs       automatically mounts filesystems when you use them,
+#              and unmounts them later when you are not using them.
 #
-#      /etc/rc.d/init.d/autofs
+# chkconfig:   2345 72 08
 #
-#      rc file for automount using a Sun-style "master map".
-#      We first look for a local /etc/auto.master, then a YP
-#      map with that name
+# description: Script for automount using a Sun-style "master map".
+#              We first look for a local /etc/autofs/auto.master, then a YP
+#              map with that name
 #
-# chkconfig: - 72 08
-# description: automatically mounts filesystems when you use \
-#   them, and unmounts them later when you are not using them.
-# processname: automount
-#   Note that there may be multiple processes names automount
-# config: /etc/auto.master
-#   Note that all other config files are automatically reloaded
-#   and may be different on different systems; we can ignore them
-#   here
+# processname: automount
+# config:      /etc/autofs/auto.master
 
-# Source function library.
+
+# Source function library
 . /etc/rc.d/init.d/functions
 
-[ -f /usr/sbin/automount ] || exit 0
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/inetd ] && . /etc/sysconfig/inetd
+
+# Check that networking is up.
+[ "${NETWORKING}" = "no" ] && echo "Error: Networking is down"; exit 0
+
 
-#
 #      We can add local options here
 #      e.g. localoptions='rsize=8192,wsize=8192'
 #
@@ -34,7 +36,7 @@ localoptions=''
 #      order # to activate all the mount points. It is used to figure out
 #      the difference of automount points in case of a reload
 #
-function getmounts()
+getmounts()
 {
 #
 #      Check for local maps to be loaded
@@ -100,49 +102,30 @@ fi
 #
 case "$1" in
   start)
-       # Check if the automounter is already running?
+       # Check if the service is already running?
        if [ ! -f /var/lock/subsys/automount ]; then
-           show Starting automounter
-           busy
-           getmounts | sh
-           touch /var/lock/subsys/automount
-           deltext
-           ok
+               show Starting automounter
+               busy
+               getmounts | sh
+               deltext
+               ok
+       else
+           echo "automount already is running"
        fi
+       touch /var/lock/subsys/automount
        ;;
   stop)
        show Stopping automounter
-       busy
-        kill -TERM $(/sbin/pidof /usr/sbin/automount)
+       killproc automount -TERM
        rm -f /var/lock/subsys/automount
-       deltext
-       ok
        ;;
-  reload|restart)
+  restart|reload)
        if [ ! -f /var/lock/subsys/automount ]; then
                echo "Automounter not running"
                exit 1
        fi
-       echo "Checking for changes to /etc/auto.master ...."
-       TMP1=`mktemp /tmp/autofs.XXXXXX` || { echo "could not make temp file" >&2; exit 1; }
-       TMP2=`mktemp /tmp/autofs.XXXXXX` || { echo "could not make temp file" >&2; exit 1; }
-       getmounts >$TMP1
-       ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | (
-           while read pid tt stat time command; do
-               echo "$command" >>$TMP2
-               if ! grep -q "^$command" $TMP2; then
-                       kill -USR2 $pid
-                       echo "Stop $command"
-               fi
-           done
-       )
-       cat $TMP1 | ( while read x; do
-               if ! grep -q "^$x" $TMP2; then
-                       $x
-                       echo "Start $x"
-               fi
-        done )
-       rm -f $TMP1 $TMP2
+       $0 stop
+       $0 start
        ;;
   status)
        echo "Configured Mount Points:"
This page took 0.746224 seconds and 4 git commands to generate.