]> git.decadent.org.uk Git - nfs-utils.git/blob - etc/redhat/rpcidmapd.init
Prepare to support gss authentication and idmap looks for nfsv4
[nfs-utils.git] / etc / redhat / rpcidmapd.init
1 #!/bin/bash
2 #
3 # rpcidmapd     Start up and shut down RPC name to UID/GID mapper
4 #
5 # Authors:      Chuck Lever <cel@netapp.com>
6 #
7 # chkconfig: 0356 19 69
8 # description: Starts user-level daemon for NFSv4 that maps user \
9 #              names to UID and GID numbers.
10
11 # Source function library.
12 . /etc/init.d/functions
13
14 # Source networking configuration.
15 if [ ! -f /etc/sysconfig/network ]; then
16     exit 0
17 fi
18 . /etc/sysconfig/network
19
20 # Check that networking is up.
21 [ "${NETWORKING}" = "no" ] && exit 0
22
23 [ ! -x /usr/sbin/rpc.idmapd ] && exit 0
24
25 OPTIONS=""
26 RETVAL=0
27 prog="rpc.idmapd"
28
29 case "$1" in
30   start)
31         # make sure the rpc pipe fs is mounted already
32         RPCMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
33         if [ -n "$RPCMTAB" ]; then
34                 # Start daemon.
35                 echo -n $"Starting $prog: "
36                 daemon /usr/sbin/rpc.idmapd ${OPTIONS} -p ${RPCMTAB}/nfs
37                 RETVAL=$?
38                 echo
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rpc.idmapd
40         fi
41         ;;
42   stop)
43         # Stop daemon.
44         echo -n $"Shutting down $prog: "
45         killproc $prog
46         RETVAL=$?
47         echo
48         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rpc.idmapd
49         ;;
50   status)
51         status rpc.idmapd
52         RETVAL=$?
53         ;;
54   restart|reload)
55         $0 stop
56         $0 start
57         RETVAL=$?
58         ;;
59   condrestart)
60         if [ -f /var/lock/subsys/rpc.idmapd ]; then
61                 $0 restart
62                 RETVAL=$?
63         fi
64         ;;
65   *)
66         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
67         exit 1
68 esac
69
70 exit $RETVAL