]>
Commit | Line | Data |
---|---|---|
6c47947b JR |
1 | #!/bin/sh |
2 | # | |
403e6325 | 3 | # rquotad This shell script takes care of starting and stopping |
ea233620 | 4 | # the RPC rquotad service. |
6c47947b | 5 | # |
f7a9f4a0 | 6 | # chkconfig: 345 12 82 |
ea233620 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 | |
6c47947b 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. | |
403e6325 | 23 | if is_yes "${NETWORKING}"; then |
4e2a6136 | 24 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
ea233620 | 25 | msg_network_down "RPC rquotad" |
403e6325 | 26 | exit 1 |
27 | fi | |
28 | else | |
29 | exit 0 | |
6c47947b JR |
30 | fi |
31 | ||
7da69140 JR |
32 | if [ "$1" != "stop" ]; then |
33 | check_portmapper || { nls "Error: portmap isn't running" && exit 0; } | |
6c47947b JR |
34 | fi |
35 | ||
a2a265b1 | 36 | start() { |
9ed92f91 JB |
37 | # Check if the service is already running? |
38 | if [ ! -f /var/lock/subsys/rquotad ]; then | |
d080d613 JR |
39 | # RQUOTADOPTIONS will be removed in the future |
40 | OPTIONS="$RQUOTADOPTIONS" | |
41 | [ -n "$RQUOTAD_PORT" ] && OPTIONS="$OPTIONS -p $RQUOTAD_PORT" | |
42 | is_yes "$AUTOFS" && OPTIONS="$OPTIONS --autofs" | |
43 | if is_yes "$REMOTE_QUOTA_SETTING"; then | |
44 | OPTIONS="$OPTIONS --setquota" | |
45 | else | |
46 | OPTIONS="$OPTIONS --no-setquota" | |
47 | fi | |
9ed92f91 | 48 | # Start daemons. |
ea233620 | 49 | msg_starting "RPC rquotad" |
d080d613 | 50 | daemon rpc.rquotad $OPTIONS |
c79d543e | 51 | RETVAL=$? |
52 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rquotad | |
9ed92f91 | 53 | else |
ea233620 | 54 | msg_already_running "RPC rquotad" |
9ed92f91 | 55 | fi |
a2a265b1 ER |
56 | } |
57 | ||
58 | stop() { | |
403e6325 | 59 | if [ -f /var/lock/subsys/rquotad ]; then |
9ed92f91 | 60 | # Stop daemons. |
ea233620 | 61 | msg_stopping "RPC rquotad" |
9ed92f91 JB |
62 | killproc rpc.rquotad |
63 | rm -f /var/lock/subsys/rquotad | |
64 | else | |
ea233620 | 65 | msg_not_running "RPC rquotad" |
9ed92f91 | 66 | fi |
a2a265b1 ER |
67 | } |
68 | ||
69 | RETVAL=0 | |
70 | # See how we were called. | |
71 | case "$1" in | |
72 | start) | |
73 | start | |
74 | ;; | |
75 | stop) | |
76 | stop | |
6c47947b JR |
77 | ;; |
78 | status) | |
79 | status rpc.rquotad | |
c79d543e | 80 | exit $? |
6c47947b | 81 | ;; |
c79d543e | 82 | restart|force-reload) |
a2a265b1 ER |
83 | stop |
84 | start | |
6c47947b JR |
85 | ;; |
86 | probe) | |
567168fe | 87 | if [ ! -f /var/lock/subsys/quotad ]; then |
403e6325 | 88 | echo start; exit 0 |
6c47947b | 89 | fi |
a2a265b1 | 90 | /sbin/pidof rpc.rquotad >/dev/null 2>&1 |
567168fe | 91 | if [ $? = 1 ]; then |
403e6325 | 92 | echo restart; exit 0 |
6c47947b JR |
93 | fi |
94 | ;; | |
95 | *) | |
c79d543e | 96 | msg_usage "$0 {start|stop|restart|force-reload|probe|status}" |
97 | exit 3 | |
6c47947b JR |
98 | esac |
99 | ||
c79d543e | 100 | exit $RETVAL |