]>
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 | ||
167d2acc PG |
27 | # Get service configuration |
28 | [ -f /etc/sysconfig/rsyncd ] && . /etc/sysconfig/rsyncd | |
f2499957 | 29 | |
866a0dbe | 30 | RETVAL=0 |
f2499957 PG |
31 | # See how we were called. |
32 | case "$1" in | |
33 | start) | |
8d37145d | 34 | # Start daemons. |
f2499957 PG |
35 | if [ ! -f /var/lock/subsys/rsyncd ]; then |
36 | msg_starting rsyncd | |
167d2acc | 37 | daemon rsync --daemon ${RSYNC_OPTIONS} |
f2499957 PG |
38 | RETVAL=$? |
39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rsyncd | |
40 | else | |
41 | msg_already_running rsyncd | |
42 | fi | |
43 | ;; | |
44 | stop) | |
45 | # Stop daemons. | |
46 | if [ -f /var/lock/subsys/rsyncd ]; then | |
47 | msg_stopping rsyncd | |
48 | killproc rsync | |
49 | rm -f /var/lock/subsys/rsyncd >/dev/null 2>&1 | |
50 | else | |
51 | msg_not_running rsyncd | |
f2499957 PG |
52 | fi |
53 | ;; | |
167d2acc | 54 | restart|reload|force-restart|force-reload) |
f2499957 PG |
55 | $0 stop |
56 | $0 start | |
866a0dbe | 57 | exit $? |
f2499957 PG |
58 | ;; |
59 | status) | |
04f5b32e | 60 | status rsyncd rsync |
866a0dbe | 61 | exit $? |
f2499957 PG |
62 | ;; |
63 | *) | |
167d2acc | 64 | msg_usage "$0 {start|stop|restart|reload|force-restart|force-reload|status}" |
866a0dbe | 65 | exit 3 |
f2499957 | 66 | esac |
866a0dbe | 67 | |
68 | exit $RETVAL |