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