]>
Commit | Line | Data |
---|---|---|
099644da JR |
1 | #!/bin/sh |
2 | # | |
22e78c3b | 3 | # rquotad This shell script takes care of starting and stopping |
cb71d8be | 4 | # the RPC rquotad service. |
099644da | 5 | # |
891a86c9 | 6 | # chkconfig: 345 12 82 |
cb71d8be JR |
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 | |
099644da JR |
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. | |
22e78c3b | 23 | if is_yes "${NETWORKING}"; then |
b69cfb4d | 24 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
cb71d8be | 25 | msg_network_down "RPC rquotad" |
22e78c3b | 26 | exit 1 |
27 | fi | |
28 | else | |
29 | exit 0 | |
099644da JR |
30 | fi |
31 | ||
fec53330 | 32 | if [ -x /sbin/pidof ] && [ "$1" != "stop" ] && [ -z "`/sbin/pidof portmap`" ]; then |
33 | echo "Error: portmap isn't running" | |
0de24d28 | 34 | exit 0 |
099644da JR |
35 | fi |
36 | ||
2562982d | 37 | start() { |
73f8a2e1 JB |
38 | # Check if the service is already running? |
39 | if [ ! -f /var/lock/subsys/rquotad ]; then | |
2ef98933 JR |
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 | |
73f8a2e1 | 49 | # Start daemons. |
cb71d8be | 50 | msg_starting "RPC rquotad" |
2ef98933 | 51 | daemon rpc.rquotad $OPTIONS |
768b24e2 | 52 | RETVAL=$? |
53 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rquotad | |
73f8a2e1 | 54 | else |
cb71d8be | 55 | msg_already_running "RPC rquotad" |
73f8a2e1 | 56 | fi |
2562982d ER |
57 | } |
58 | ||
59 | stop() { | |
22e78c3b | 60 | if [ -f /var/lock/subsys/rquotad ]; then |
73f8a2e1 | 61 | # Stop daemons. |
cb71d8be | 62 | msg_stopping "RPC rquotad" |
73f8a2e1 JB |
63 | killproc rpc.rquotad |
64 | rm -f /var/lock/subsys/rquotad | |
65 | else | |
cb71d8be | 66 | msg_not_running "RPC rquotad" |
73f8a2e1 | 67 | fi |
2562982d ER |
68 | } |
69 | ||
70 | RETVAL=0 | |
71 | # See how we were called. | |
72 | case "$1" in | |
73 | start) | |
74 | start | |
75 | ;; | |
76 | stop) | |
77 | stop | |
099644da JR |
78 | ;; |
79 | status) | |
80 | status rpc.rquotad | |
768b24e2 | 81 | exit $? |
099644da | 82 | ;; |
768b24e2 | 83 | restart|force-reload) |
2562982d ER |
84 | stop |
85 | start | |
099644da JR |
86 | ;; |
87 | probe) | |
5da51246 | 88 | if [ ! -f /var/lock/subsys/quotad ]; then |
22e78c3b | 89 | echo start; exit 0 |
099644da | 90 | fi |
2562982d | 91 | /sbin/pidof rpc.rquotad >/dev/null 2>&1 |
5da51246 | 92 | if [ $? = 1 ]; then |
22e78c3b | 93 | echo restart; exit 0 |
099644da JR |
94 | fi |
95 | ;; | |
96 | *) | |
768b24e2 | 97 | msg_usage "$0 {start|stop|restart|force-reload|probe|status}" |
98 | exit 3 | |
099644da JR |
99 | esac |
100 | ||
768b24e2 | 101 | exit $RETVAL |