]> git.pld-linux.org Git - packages/clusternfs.git/blob - clusternfs.init
- rel up to resolve conflict with rpcbind
[packages/clusternfs.git] / clusternfs.init
1 #!/bin/sh
2 #
3 # init file for ClusterNFS
4 #
5 # chkconfig:    345 50 50
6 #
7 # description: ClusterNFS server
8 #
9
10 # source function library
11 . /etc/rc.d/init.d/functions
12
13 # Get network config
14 . /etc/sysconfig/network
15
16 # defaults
17 OPTIONS_NFSD="-T"
18 OPTIONS_MNTD="-T"
19
20 # Get service config
21 [ -f /etc/sysconfig/clusternfs ] && . /etc/sysconfig/clusternfs
22
23 # Check that networking is up.
24 if is_yes "${NETWORKING}"; then
25         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26                 msg_network_down ClusterNFS
27                 exit 1
28         fi
29 else
30         exit 0
31 fi
32
33 if [ "$1" != "stop" ]; then
34         check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
35 fi
36
37 # Sanity checks
38 [ -x /usr/sbin/rpc.nfsd ] || exit 0
39 [ -x /usr/sbin/rpc.mountd ] || exit 0
40 [ -f /etc/exports ] || exit 0
41
42 RETVAL=0
43 #See how we were called.
44 case "$1" in
45   start)
46         # Check if the service is already running?
47         if [ ! -f /var/lock/subsys/clusternfs ]; then
48                 msg_starting "ClusterNFS mountd"
49                 daemon /usr/sbin/rpc.mountd $OPTIONS_MNTD
50                 RETVAL=$?
51                 if [ $RETVAL -eq 0 ]; then
52                         msg_starting "ClusterNFS daemon"
53                         daemon /usr/sbin/rpc.nfsd $OPTIONS_NFSD
54                         RETVAL=$?
55                 fi
56                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clusternfs
57         else
58                 msg_already_running ClusterNFS
59         fi
60         ;;
61   stop)
62         # Stop daemons.
63         if [ -f /var/lock/subsys/clusternfs ]; then
64                 msg_stopping "ClusterNFS daemon"
65                 killproc /usr/sbin/rpc.nfsd
66                 msg_stopping "ClusterNFS mountd"
67                 killproc /usr/sbin/rpc.mountd
68                 rm -f /var/lock/subsys/clusternfs
69         else
70                 msg_not_running ClusterNFS
71         fi
72         ;;
73   status)
74         status rpc.mountd
75         RETVAL=$?
76         status rpc.nfsd
77         RET=$?
78         [ $RETVAL -eq 0 ] && RETVAL=$RET
79         ;;
80   restart|force-reload)
81         $0 stop
82         $0 start
83         exit $?
84         ;;
85   *)
86         msg_usage "$0 {start|stop|restart|force-reload|status}"
87         exit 3
88 esac
89
90 exit $RETVAL
This page took 0.059403 seconds and 3 git commands to generate.