]>
Commit | Line | Data |
---|---|---|
f2499957 PG |
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_no "${NETWORKING}"; then | |
19 | msg_network_down rsyncd | |
20 | exit 1 | |
21 | fi | |
22 | ||
23 | . /etc/sysconfig/rsyncd | |
24 | ||
25 | # See how we were called. | |
26 | case "$1" in | |
27 | start) | |
28 | # Start daemons. | |
29 | if [ ! -f /var/lock/subsys/rsyncd ]; then | |
30 | msg_starting rsyncd | |
31 | daemon rsync --daemon | |
32 | RETVAL=$? | |
33 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rsyncd | |
34 | else | |
35 | msg_already_running rsyncd | |
36 | fi | |
37 | ;; | |
38 | stop) | |
39 | # Stop daemons. | |
40 | if [ -f /var/lock/subsys/rsyncd ]; then | |
41 | msg_stopping rsyncd | |
42 | killproc rsync | |
43 | rm -f /var/lock/subsys/rsyncd >/dev/null 2>&1 | |
44 | else | |
45 | msg_not_running rsyncd | |
46 | exit 1 | |
47 | fi | |
48 | ;; | |
49 | restart) | |
50 | $0 stop | |
51 | $0 start | |
52 | ;; | |
53 | status) | |
54 | status rsyncd | |
55 | ;; | |
56 | *) | |
57 | msg_usage "$0 {start|stop|restart|status}" | |
58 | exit 1 | |
59 | esac |