]> git.pld-linux.org Git - packages/rsync.git/blob - rsync.init
- tabs
[packages/rsync.git] / rsync.init
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 # Get service configuration
28 [ -f /etc/sysconfig/rsyncd ] && . /etc/sysconfig/rsyncd
29
30 start() {
31         # Start daemons.
32         if [ ! -f /var/lock/subsys/rsyncd ]; then
33                 msg_starting rsyncd
34                 daemon rsync --daemon ${RSYNC_OPTIONS}
35                 RETVAL=$?
36                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rsyncd
37         else
38                 msg_already_running rsyncd
39         fi
40 }
41
42 stop() {
43         # Stop daemons.
44         if [ -f /var/lock/subsys/rsyncd ]; then
45                 msg_stopping rsyncd
46                 killproc rsync
47                 rm -f /var/lock/subsys/rsyncd >/dev/null 2>&1
48         else
49                 msg_not_running rsyncd
50         fi
51 }
52
53 RETVAL=0
54 # See how we were called.
55 case "$1" in
56   start)
57         start
58         ;;
59   stop)
60         stop
61         ;;
62   restart|force-restart|force-reload)
63         stop
64         start
65         ;;
66   status)
67         status rsyncd rsync
68         exit $?
69         ;;
70   *)
71         msg_usage "$0 {start|stop|restart|force-restart|force-reload|status}"
72         exit 3
73 esac
74
75 exit $RETVAL
This page took 0.078184 seconds and 3 git commands to generate.