]> git.pld-linux.org Git - packages/nfs-utils.git/blob - rquotad.init
- R: rc-scripts >= 0.4.1.5 for check_portmapper function
[packages/nfs-utils.git] / rquotad.init
1 #!/bin/sh
2 #
3 # rquotad       This shell script takes care of starting and stopping
4 #               the RPC rquotad service.
5 #
6 # chkconfig:    345 12 82
7 # description:  rquotad is an RPC server which returns quotas for \
8 #               a user of a local filesystem which is mounted by \
9 #               a remote machine over the NFS.  It also allows \
10 #               setting  of quotas on NFS mounted filesystem
11 # probe: true
12
13 # Source function library.
14 . /etc/rc.d/init.d/functions
15
16 # Get network config
17 . /etc/sysconfig/network
18
19 # Get service config
20 [ -f /etc/sysconfig/rquotad ] && . /etc/sysconfig/rquotad
21
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25                 msg_network_down "RPC rquotad"
26                 exit 1
27         fi
28 else
29         exit 0
30 fi
31
32 if [ -x /sbin/pidof ] && [ "$1" != "stop" ] && [ -z "`/sbin/pidof portmap`" ]; then
33         echo "Error: portmap isn't running"
34         exit 0
35 fi
36
37 start() {
38         # Check if the service is already running?
39         if [ ! -f /var/lock/subsys/rquotad ]; then
40                 # RQUOTADOPTIONS will be removed in the future
41                 OPTIONS="$RQUOTADOPTIONS"
42                 [ -n "$RQUOTAD_PORT" ] && OPTIONS="$OPTIONS -p $RQUOTAD_PORT"
43                 is_yes "$AUTOFS" && OPTIONS="$OPTIONS --autofs"
44                 if is_yes "$REMOTE_QUOTA_SETTING"; then
45                     OPTIONS="$OPTIONS --setquota"
46                 else
47                     OPTIONS="$OPTIONS --no-setquota"
48                 fi
49                 # Start daemons.
50                 msg_starting "RPC rquotad"
51                 daemon rpc.rquotad $OPTIONS
52                 RETVAL=$?
53                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rquotad
54         else
55                 msg_already_running "RPC rquotad"
56         fi
57 }
58
59 stop() {
60         if [ -f /var/lock/subsys/rquotad ]; then
61                 # Stop daemons.
62                 msg_stopping "RPC rquotad"
63                 killproc rpc.rquotad
64                 rm -f /var/lock/subsys/rquotad
65         else
66                 msg_not_running "RPC rquotad"
67         fi
68 }
69
70 RETVAL=0
71 # See how we were called.
72 case "$1" in
73   start)
74         start
75         ;;
76   stop)
77         stop
78         ;;
79   status)
80         status rpc.rquotad
81         exit $?
82         ;;
83   restart|force-reload)
84         stop
85         start
86         ;;
87   probe)
88         if [ ! -f /var/lock/subsys/quotad ]; then
89                 echo start; exit 0
90         fi
91         /sbin/pidof rpc.rquotad >/dev/null 2>&1
92         if [ $? = 1 ]; then
93                 echo restart; exit 0
94         fi
95         ;;
96   *)
97         msg_usage "$0 {start|stop|restart|force-reload|probe|status}"
98         exit 3
99 esac
100
101 exit $RETVAL
This page took 0.215771 seconds and 3 git commands to generate.