]>
Commit | Line | Data |
---|---|---|
042f4ecc JR |
1 | #!/bin/sh |
2 | # | |
3 | # idmapd Start up and shut down RPC name to UID/GID mapper | |
4 | # | |
5 | # chkconfig: 345 12 83 | |
6 | # description: Starts user-level daemon for NFSv4 that maps user \ | |
7 | # names to UID and GID numbers. | |
8 | ||
9 | # Source function library. | |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Get network config | |
13 | . /etc/sysconfig/network | |
14 | ||
15 | # Check that networking is up. | |
16 | if is_yes "${NETWORKING}"; then | |
17 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
18 | msg_network_down "RPC idmapd" | |
19 | exit 1 | |
20 | fi | |
21 | else | |
22 | exit 0 | |
23 | fi | |
24 | ||
25 | # Get service config | |
26 | [ -f /etc/sysconfig/nfsfs ] && . /etc/sysconfig/nfsfs | |
27 | [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd | |
28 | ||
042f4ecc JR |
29 | # Find out what the current runlevel dir is |
30 | RUNLEVELDIR=$(cat /var/run/runlevel.dir) | |
31 | ||
32 | start() { | |
33 | # Check if the service is already running? | |
34 | if [ -f /var/lock/subsys/idmapd ]; then | |
35 | msg_already_running "RPC idmapd" | |
36 | return | |
37 | fi | |
38 | ||
39 | # This is whacko, but we need /proc/fs/nfsd mounted before | |
40 | # starting idmapd on NFS server | |
41 | if [ -e "$RUNLEVELDIR"/S*nfs ]; then | |
42 | if ! grep -q nfsd /proc/mounts ; then | |
43 | modprobe nfsd > /dev/null 2>&1 | |
44 | run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd | |
45 | fi | |
46 | fi | |
47 | if ! grep -q rpc_pipefs /proc/mounts; then | |
48 | modprobe sunrpc >/dev/null 2>&1 | |
49 | run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \ | |
50 | mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs | |
51 | fi | |
52 | ||
53 | msg_starting "RPC idmapd" | |
678e9da9 | 54 | daemon /sbin/rpc.idmapd $RPCIDMAPOPTIONS |
042f4ecc JR |
55 | RETVAL=$? |
56 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/idmapd | |
57 | } | |
58 | ||
59 | stop() { | |
60 | if [ ! -f /var/lock/subsys/idmapd ]; then | |
61 | msg_not_running "RPC idmapd" | |
62 | return | |
63 | fi | |
64 | ||
65 | msg_stopping "RPC idmapd" | |
66 | killproc rpc.idmapd | |
67 | rm -f /var/lock/subsys/idmapd | |
68 | } | |
69 | ||
70 | # See how we were called. | |
71 | RETVAL=0 | |
72 | case "$1" in | |
73 | start) | |
74 | start | |
75 | ;; | |
76 | stop) | |
77 | stop | |
78 | ;; | |
79 | restart) | |
80 | stop | |
81 | start | |
82 | ;; | |
83 | reload) | |
84 | if [ -f /var/lock/subsys/idmapd ]; then | |
85 | msg_reloading "RPC idmapd" | |
86 | killproc rpc.idmapd -HUP | |
87 | RETVAL=$? | |
88 | else | |
89 | msg_not_running "RPC idmapd" | |
90 | exit 7 | |
91 | fi | |
92 | ;; | |
93 | status) | |
94 | status rpc.idmapd | |
95 | RETVAL=$? | |
96 | ;; | |
97 | *) | |
98 | msg_usage "$0 {start|stop|restart|reload|status}" | |
99 | exit 1 | |
100 | esac | |
101 | ||
102 | exit $RETVAL |