]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # rsyncd This shell script takes care of starting and stopping rsyncd | |
4 | # | |
5 | # chkconfig: 345 90 25 | |
6 | # description: rsync daemon | |
7 | # processname: rsync | |
8 | # | |
9 | # pidfile: /var/run/rsyncd.pid | |
10 | ||
11 | # Source function library. | |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # Source networking configuration. | |
15 | . /etc/sysconfig/network | |
16 | ||
17 | # Check that networking is up. | |
18 | if is_yes "${NETWORKING}"; then | |
19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
20 | msg_network_down rsyncd | |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
25 | fi | |
26 | ||
27 | . /etc/sysconfig/rsyncd | |
28 | ||
29 | RETVAL=0 | |
30 | # See how we were called. | |
31 | case "$1" in | |
32 | start) | |
33 | # Start daemons. | |
34 | if [ ! -f /var/lock/subsys/rsyncd ]; then | |
35 | msg_starting rsyncd | |
36 | daemon rsync --daemon | |
37 | RETVAL=$? | |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rsyncd | |
39 | else | |
40 | msg_already_running rsyncd | |
41 | fi | |
42 | ;; | |
43 | stop) | |
44 | # Stop daemons. | |
45 | if [ -f /var/lock/subsys/rsyncd ]; then | |
46 | msg_stopping rsyncd | |
47 | killproc rsync | |
48 | rm -f /var/lock/subsys/rsyncd >/dev/null 2>&1 | |
49 | else | |
50 | msg_not_running rsyncd | |
51 | fi | |
52 | ;; | |
53 | restart|force-reload) | |
54 | $0 stop | |
55 | $0 start | |
56 | exit $? | |
57 | ;; | |
58 | status) | |
59 | status rsync | |
60 | exit $? | |
61 | ;; | |
62 | *) | |
63 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
64 | exit 3 | |
65 | esac | |
66 | ||
67 | exit $RETVAL |