]> git.pld-linux.org Git - packages/nfs-utils.git/blob - rpcidmapd.init
- started update to 1.1.0-rc1
[packages/nfs-utils.git] / 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: 345 13 82
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/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20                 msg_network_down "RPC svcgssd daemon"
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
28         [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
29 fi
30
31 # Get service config
32 [ -f /etc/sysconfig/nfsfs ] && . /etc/sysconfig/nfsfs
33 [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd
34
35 # /usr may be on NFS, fail silently, nfsfs will start it
36 [ -x /usr/sbin/rpc.idmapd ] || exit 0
37
38 # Find out what the current runlevel dir is
39 RUNLEVELDIR=$(cat /var/run/runlevel.dir)
40
41 RETVAL=0
42
43 # See how we were called.
44 case "$1" in
45   start)
46         # Check if the service is already running?
47         if [ ! -f /var/lock/subsys/idmapd ]; then
48                 # This is whacko, but we need /proc/fs/nfsd mounted before
49                 # starting idmapd on NFS server
50                 if [ -e "$RUNLEVELDIR/S*nfs" ]; then
51                         if ! grep -q nfsd /proc/mounts ; then
52                                 modprobe -s nfsd > /dev/null 2>&1
53                                 run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd
54                         fi
55                 fi
56                 if ! grep -q rpc_pipefs /proc/mounts ; then
57                         modprobe -s sunrpc >/dev/null 2>&1
58                         run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \
59                                 mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
60                 fi
61
62                 msg_starting "RPC idmapd"
63                 daemon rpc.idmapd $RPCIDMAPOPTIONS
64                 RETVAL=$?
65                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/idmapd
66         else
67                 msg_already_running "RPC idmapd"
68         fi
69         ;;
70   stop)
71         if [ -f /var/lock/subsys/idmapd ]; then
72                 msg_stopping "RPC idmapd"
73                 killproc rpc.idmapd
74                 rm -f /var/lock/subsys/idmapd
75         else
76                 msg_not_running "RPC idmapd"
77         fi
78         ;;
79   status)
80         status rpc.idmapd
81         RETVAL=$?
82         ;;
83   restart)
84         $0 stop
85         $0 start
86         RETVAL=$?
87         ;;
88   reload)
89         if [ -f /var/lock/subsys/idmapd ]; then
90                 msg_reloading "RPC idmapd"
91                 killproc rpc.idmapd -HUP
92                 RETVAL=$?
93         else
94                 msg_not_running "RPC idmapd" >&2
95                 exit 7
96         fi
97         ;;
98   *)
99         msg_usage "$0 {start|stop|restart|reload|status}"
100         exit 1
101 esac
102
103 exit $RETVAL
This page took 0.065902 seconds and 3 git commands to generate.