]> git.pld-linux.org Git - packages/nfs-utils.git/blob - rpcidmapd.init
- consistent messages
[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 12 83
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"
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 start() {
42         # Check if the service is already running?
43         if [ ! -f /var/lock/subsys/idmapd ]; then
44                 # This is whacko, but we need /proc/fs/nfsd mounted before
45                 # starting idmapd on NFS server
46                 if [ -e "$RUNLEVELDIR"/S*nfs ]; then
47                         if ! grep -q nfsd /proc/mounts ; then
48                                 modprobe -s nfsd > /dev/null 2>&1
49                                 run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd
50                         fi
51                 fi
52                 if ! grep -q rpc_pipefs /proc/mounts ; then
53                         modprobe -s sunrpc >/dev/null 2>&1
54                         run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \
55                                 mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
56                 fi
57
58                 msg_starting "RPC idmapd"
59                 daemon rpc.idmapd $RPCIDMAPOPTIONS
60                 RETVAL=$?
61                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/idmapd
62         else
63                 msg_already_running "RPC idmapd"
64         fi
65 }
66
67 stop() {
68         if [ -f /var/lock/subsys/idmapd ]; then
69                 msg_stopping "RPC idmapd"
70                 killproc rpc.idmapd
71                 rm -f /var/lock/subsys/idmapd
72         else
73                 msg_not_running "RPC idmapd"
74         fi
75 }
76
77 # See how we were called.
78 RETVAL=0
79 case "$1" in
80   start)
81         start
82         ;;
83   stop)
84         stop
85         ;;
86   status)
87         status rpc.idmapd
88         RETVAL=$?
89         ;;
90   restart)
91         stop
92         start
93         ;;
94   reload)
95         if [ -f /var/lock/subsys/idmapd ]; then
96                 msg_reloading "RPC idmapd"
97                 killproc rpc.idmapd -HUP
98                 RETVAL=$?
99         else
100                 msg_not_running "RPC idmapd" >&2
101                 exit 7
102         fi
103         ;;
104   *)
105         msg_usage "$0 {start|stop|restart|reload|status}"
106         exit 1
107 esac
108
109 exit $RETVAL
This page took 0.053928 seconds and 4 git commands to generate.