2004-09-09 09:27:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# rpcidmapd Start up and shut down RPC name to UID/GID mapper
|
|
|
|
#
|
2007-07-30 10:10:07 +00:00
|
|
|
# chkconfig: 345 18 85
|
2004-09-09 09:27:26 +00:00
|
|
|
# description: Starts user-level daemon for NFSv4 that maps user \
|
|
|
|
# names to UID and GID numbers.
|
|
|
|
|
2009-06-10 16:14:13 +00:00
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: rpcidmapd
|
|
|
|
# Required-Start: $network $syslog
|
|
|
|
# Required-Stop: $network $syslog
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: Starts the NFSv4 id mapping daemon
|
|
|
|
# Description: NFS is a popular protocol for file sharing across \
|
|
|
|
# networks. This deamon maps user names and groups to UID \
|
|
|
|
# and GID numbers on NFSv4 mounts.
|
|
|
|
### END INIT INFO
|
|
|
|
|
2004-09-09 09:27:26 +00:00
|
|
|
# Source function library.
|
|
|
|
. /etc/init.d/functions
|
|
|
|
|
|
|
|
# Source networking configuration.
|
2008-09-16 20:29:11 +00:00
|
|
|
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
|
2004-09-09 09:27:26 +00:00
|
|
|
|
2007-05-15 15:03:52 +00:00
|
|
|
# Check for and source configuration file otherwise set defaults
|
|
|
|
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
|
|
|
|
|
2004-09-09 09:27:26 +00:00
|
|
|
RETVAL=0
|
2006-01-11 21:55:51 +00:00
|
|
|
LOCKFILE=/var/lock/subsys/rpcidmapd
|
2004-09-09 09:27:26 +00:00
|
|
|
prog="rpc.idmapd"
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start|condstart)
|
2008-09-16 20:29:11 +00:00
|
|
|
# Check that networking is up.
|
|
|
|
[ "${NETWORKING}" != "yes" ] && exit 6
|
|
|
|
|
|
|
|
[ ! -x /usr/sbin/rpc.idmapd ] && exit 5
|
|
|
|
|
2004-09-09 09:27:26 +00:00
|
|
|
# Make sure the daemon is not already running.
|
2005-09-08 14:27:06 +00:00
|
|
|
[ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && {
|
|
|
|
killproc $prog "-SIGHUP" > /dev/null
|
2004-09-09 09:27:26 +00:00
|
|
|
exit 0
|
2005-09-08 14:27:06 +00:00
|
|
|
}
|
2008-09-16 20:29:11 +00:00
|
|
|
[ "$1" = "start" ] && {
|
|
|
|
if status $prog > /dev/null ; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
}
|
2006-01-11 21:55:51 +00:00
|
|
|
rm -f $LOCKFILE
|
2004-09-09 09:27:26 +00:00
|
|
|
|
2005-02-14 19:29:31 +00:00
|
|
|
echo -n $"Starting RPC idmapd: "
|
2004-09-09 09:27:26 +00:00
|
|
|
|
2007-07-30 10:10:07 +00:00
|
|
|
# Make sure the rpc_pipefs filesystem is available
|
|
|
|
[ "${RPCMTAB}" != "noload" ] && {
|
|
|
|
RPCMTAB=`grep -v '^#' /proc/mounts | \
|
|
|
|
awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
|
|
|
|
[ -z "${RPCMTAB}" ] && {
|
|
|
|
[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
|
|
|
|
if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
|
|
|
|
/sbin/modprobe sunrpc
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
RPCMTAB=`grep -v '^#' /proc/mounts | \
|
|
|
|
awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
|
|
|
|
[ -z "${RPCMTAB}" ] && { \
|
|
|
|
echo "Error: RPC MTAB does not exist."
|
|
|
|
exit 6
|
|
|
|
}
|
|
|
|
}
|
2004-09-09 09:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Start daemon.
|
2007-05-15 15:03:52 +00:00
|
|
|
daemon $prog ${RPCIDMAPDARGS}
|
2004-09-09 09:27:26 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2006-01-11 21:55:51 +00:00
|
|
|
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
2004-09-09 09:27:26 +00:00
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
# Stop daemon.
|
2007-07-30 10:10:07 +00:00
|
|
|
echo -n $"Stopping RPC idmapd: "
|
2004-09-09 09:27:26 +00:00
|
|
|
killproc $prog
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2007-08-02 15:54:05 +00:00
|
|
|
rm -f $LOCKFILE
|
2004-09-09 09:27:26 +00:00
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status rpc.idmapd
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
restart|reload)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
condrestart)
|
2006-01-11 21:55:51 +00:00
|
|
|
if [ -f $LOCKFILE ]; then
|
2004-09-09 09:27:26 +00:00
|
|
|
$0 restart
|
|
|
|
RETVAL=$?
|
|
|
|
fi
|
|
|
|
;;
|
2008-07-02 23:35:53 +00:00
|
|
|
condstop)
|
|
|
|
if [ -f $LOCKFILE ]; then
|
|
|
|
$0 stop
|
|
|
|
RETVAL=$?
|
|
|
|
fi
|
|
|
|
;;
|
2004-09-09 09:27:26 +00:00
|
|
|
*)
|
2008-07-02 23:35:53 +00:00
|
|
|
echo $"Usage: $0 {start|stop|restart|condstart|condrestart|status|condstop}"
|
2007-07-30 10:10:07 +00:00
|
|
|
RETVAL=3
|
|
|
|
;;
|
2004-09-09 09:27:26 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|