Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#!/bin/bash
2
#
3
# rpcidmapd     Start up and shut down RPC name to UID/GID mapper
4
#
5
# chkconfig: 345 18 85
6
# description: Starts user-level daemon for NFSv4 that maps user \
7
#              names to UID and GID numbers.
8
 
9
### BEGIN INIT INFO
10
# Provides: rpcidmapd
11
# Required-Start: $network $syslog
12
# Required-Stop: $network $syslog
13
# Default-Start: 3 4 5
14
# Default-Stop: 0 1 6
15
# Short-Description: Starts the NFSv4 id mapping daemon
16
# Description: NFS is a popular protocol for file sharing across \
17
#          networks. This deamon maps user names and groups to UID \
18
#          and GID numbers on NFSv4 mounts.
19
### END INIT INFO
20
 
21
# Source function library.
22
. /etc/init.d/functions
23
 
24
# Source networking configuration.
25
[ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network
26
 
27
# Check for and source configuration file otherwise set defaults
28
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
29
 
30
RETVAL=0
31
prog="rpc.idmapd"
32
LOCKFILE=/var/lock/subsys/$prog
33
uid=`id | cut -d\( -f1 | cut -d= -f2`
34
 
35
case "$1" in
36
  start|condstart)
37
	# Check that networking is up.
38
	[ "${NETWORKING}" != "yes" ] && exit 6
39
 
40
	[ ! -x /usr/sbin/rpc.idmapd ] && exit 5
41
 
42
	# Only root can start the service
43
	[ $uid -ne 0 ] && exit 4
44
 
45
	# Make sure the daemon is not already running.
46
	[ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && {
47
		killproc $prog "-SIGHUP" > /dev/null
48
		exit 0
49
	}
50
	[ "$1" = "start" ] && {
51
		if status $prog > /dev/null ; then
52
			exit 0
53
		fi
54
	}
55
	rm -f $LOCKFILE
56
 
57
	echo -n $"Starting RPC idmapd: "
58
 
59
	# Make sure the rpc_pipefs filesystem is available
60
	/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
61
 
62
	# Start daemon.
63
	daemon $prog ${RPCIDMAPDARGS}
64
	RETVAL=$?
65
	echo
66
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
67
	;;
68
  stop)
69
	# Only root can stop the service
70
	[ $uid -ne 0 ] && exit 4
71
 
72
	# Stop daemon.
73
	echo -n $"Shutting down RPC idmapd: "
74
	killproc $prog
75
	RETVAL=$?
76
	echo
77
	rm -f $LOCKFILE
78
	;;
79
  status)
80
	status rpc.idmapd
81
	RETVAL=$?
82
	;;
83
  restart|reload|force-reload)
84
	$0 stop
85
	$0 start
86
	RETVAL=$?
87
	;;
88
  condrestart|try-restart)
89
	if [ -f $LOCKFILE ]; then
90
		$0 restart
91
		RETVAL=$?
92
	fi
93
	;;
94
  condstop)
95
	if [ -f $LOCKFILE ]; then
96
		$0 stop
97
		RETVAL=$?
98
	fi
99
	;;
100
  *)
101
	echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}"
102
	RETVAL=2
103
	;;
104
esac
105
 
106
exit $RETVAL