]>
Commit | Line | Data |
---|---|---|
f2499957 PG |
1 | #!/bin/sh |
2 | # | |
3 | # rsyncd This shell script takes care of starting and stopping rsyncd | |
4 | # | |
8d37145d | 5 | # chkconfig: 345 90 25 |
f2499957 PG |
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. | |
8d37145d | 18 | if is_yes "${NETWORKING}"; then |
68b03d6c | 19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
8d37145d | 20 | msg_network_down rsyncd |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
f2499957 PG |
25 | fi |
26 | ||
27 | . /etc/sysconfig/rsyncd | |
28 | ||
866a0dbe | 29 | RETVAL=0 |
f2499957 PG |
30 | # See how we were called. |
31 | case "$1" in | |
32 | start) | |
8d37145d | 33 | # Start daemons. |
f2499957 PG |
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 | |
f2499957 PG |
51 | fi |
52 | ;; | |
866a0dbe | 53 | restart|force-reload) |
f2499957 PG |
54 | $0 stop |
55 | $0 start | |
866a0dbe | 56 | exit $? |
f2499957 PG |
57 | ;; |
58 | status) | |
a9198766 | 59 | status rsync |
866a0dbe | 60 | exit $? |
f2499957 PG |
61 | ;; |
62 | *) | |
866a0dbe | 63 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
64 | exit 3 | |
f2499957 | 65 | esac |
866a0dbe | 66 | |
67 | exit $RETVAL |