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