]>
Commit | Line | Data |
---|---|---|
8ca940f0 JR |
1 | #!/bin/bash |
2 | # | |
3 | # rpcgssd Start up and shut down RPCSEC GSS daemon | |
4 | # | |
5 | # Authors: Chuck Lever <cel@netapp.com> | |
6 | # | |
7 | # chkconfig: 345 14 81 | |
8 | # description: Starts user-level daemon that manages RPCSEC GSS contexts \ | |
9 | # for the NFSv4 client. | |
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 gssd daemon" | |
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 | ||
34 | is_yes "${SECURE_NFS}" || exit 0 | |
35 | ||
36 | # List of kernel modules to load | |
37 | [ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5" | |
38 | ||
39 | # /usr may be on NFS, fail silently, nfsfs will start it | |
40 | [ -x /usr/sbin/rpc.gssd ] || exit 0 | |
41 | ||
42 | RETVAL=0 | |
43 | ||
44 | # See how we were called. | |
45 | case "$1" in | |
46 | start) | |
47 | # Check if the service is already running? | |
4797294b | 48 | if [ ! -f /var/lock/subsys/gssd ]; then |
8ca940f0 JR |
49 | if ! grep -q rpc_pipefs /proc/mounts ; then |
50 | modprobe -s sunrpc >/dev/null 2>&1 | |
51 | run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \ | |
52 | mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs | |
53 | fi | |
54 | # Load rpcsec modules | |
55 | for i in ${SECURE_NFS_MODS} ; do | |
56 | _modprobe single die $i | |
57 | done | |
58 | msg_starting "RPC gssd" | |
59 | daemon rpc.gssd $RPCGSSOPTIONS | |
60 | RETVAL=$? | |
4797294b | 61 | [ $RETVAL = 0 ] && touch /var/lock/subsys/gssd |
8ca940f0 JR |
62 | else |
63 | msg_already_running "RPC gssd" | |
64 | fi | |
65 | ;; | |
66 | stop) | |
4797294b | 67 | if [ -f /var/lock/subsys/gssd ]; then |
8ca940f0 JR |
68 | msg_stopping "RPC gssd" |
69 | killproc rpc.gssd | |
4797294b | 70 | rm -f /var/lock/subsys/gssd |
8ca940f0 JR |
71 | else |
72 | msg_not_running "RPC gssd" | |
73 | fi | |
74 | ;; | |
75 | status) | |
76 | status rpc.gssd | |
77 | RETVAL=$? | |
78 | ;; | |
79 | restart|reload) | |
80 | $0 stop | |
81 | $0 start | |
82 | RETVAL=$? | |
83 | ;; | |
84 | *) | |
85 | msg_usage "$0 {start|stop|restart|status}" | |
86 | exit 1 | |
87 | esac | |
88 | ||
89 | exit $RETVAL |