|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21585/root/etc/rc.d/rc6.d/ |
Upload File : |
#!/bin/bash
#
# $Id: rc.autofs.in,v 1.63 2006/03/30 02:09:51 raven Exp $
#
# rc file for automount using a Sun-style "master map".
#
# chkconfig: 345 28 72
# processname: /usr/sbin/automount
# config: /etc/auto.master
# description: Automounts filesystems on demand
#
# Location of the automount daemon and the init directory
#
DAEMON=/usr/sbin/automount
prog=`basename $DAEMON`
MODULE="autofs4"
DEVICE="autofs"
initdir=/etc/init.d
confdir=/etc/sysconfig
test -e $DAEMON || exit 0
if [ -r $initdir/functions ]; then
. $initdir/functions
fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
#
# load customized configuation settings
#
if [ -r $confdir/autofs ]; then
. $confdir/autofs
fi
function start() {
# Make sure autofs4 module is loaded
if ! grep -q autofs /proc/filesystems
then
echo -n "Loading $MODULE: "
# Try load the autofs4 module fail if we can't
modprobe $MODULE >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 1 ]
then
failure "Load $MODULE"
echo
return $RETVAL
else
success "Load $MODULE"
echo
fi
elif ([ -f /proc/modules ] && lsmod) | grep -q autofs[^4]
then
RETVAL=1
failure "Load $MODULE"
echo
return $RETVAL
fi
# Check misc device
if [ -n "$USE_MISC_DEVICE" -a "x$USE_MISC_DEVICE" = "xyes" ]; then
sleep 1
if [ -e "/proc/misc" ]; then
MINOR=`awk "/$DEVICE/ {print \\$1}" /proc/misc`
if [ -n "$MINOR" -a ! -c "/dev/$DEVICE" ]; then
mknod -m 0600 /dev/$DEVICE c 10 $MINOR
fi
fi
if [ -x /sbin/restorecon -a -c /dev/$DEVICE ]; then
/sbin/restorecon /dev/$DEVICE
fi
else
if [ -c /dev/$DEVICE ]; then
rm /dev/$DEVICE
fi
fi
echo -n $"Starting $prog: "
$prog $OPTIONS --pid-file /var/run/autofs.pid
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
success "$prog startup"
else
failure "$prog startup"
fi
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/autofs
else
RETVAL=1
fi
echo
return $RETVAL
}
function stop() {
echo -n $"Stopping $prog: "
count=0
while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
killproc $prog -TERM >& /dev/null
RETVAL=$?
[ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 20
count=`expr $count + 1`
done
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/autofs
else
RETVAL=1
fi
if [ -n "`pidof $prog`" ] ; then
failure "$prog shutdown"
else
success "$prog shutdown"
fi
echo
return $RETVAL
}
function restart() {
if [ -n "`pidof $prog`" ]; then
stop
if [ -n "`pidof $prog`" ]; then
# If we failed to stop, try at least one more time
# after waiting a little while
sleep 20
stop
auto_pid=`pidof $prog`
if [ -n "$auto_pid" ]; then
kill -9 $auto_pid
fi
fi
fi
start
}
function reload() {
if [ ! -f /var/lock/subsys/autofs ]; then
echo $"$prog not running"
RETVAL=1
return $RETVAL
fi
pid=`pidof $prog`
if [ -z $pid ]; then
echo $"$prog not running"
RETVAL=1
else
kill -HUP $pid 2> /dev/null
echo $"Reloading maps"
RETVAL=0
fi
return $RETVAL
}
RETVAL=0
# Only the root user may change the service status
if [ `id -u` -ne 0 ]; then
echo "insufficient privilege to change service status"
exit 4
fi
function usage() {
echo $"Usage: $0 {start|forcestart|stop|status|restart|forcerestart|reload|condrestart|force-reload|try-restart|usage}"
}
case "$1" in
start)
start
;;
forcestart)
OPTIONS="$OPTIONS --force"
start
;;
stop)
stop
;;
status)
status -p /var/run/autofs.pid $prog
RETVAL=$?
if [ $RETVAL -eq 3 -a -e /var/lock/subsys/autofs ]; then
exit 2
else
exit $RETVAL
fi
;;
restart)
restart
;;
forcerestart)
OPTIONS="$OPTIONS --force"
restart
;;
reload)
reload
;;
condrestart)
if [ -f /var/lock/subsys/autofs ]; then
restart
fi
;;
usage)
usage
;;
try-restart|force-reload)
echo "$1 service action not supported"
usage
exit 3
;;
*)
echo "unknown, invalid or excess argument(s)"
usage
exit 2
;;
esac
exit $?