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