]> git.pld-linux.org Git - packages/rsync.git/blob - rsync.init
- release 2 (by relup.sh)
[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 /usr/bin/rsync --daemon --dparam=pidfile=/var/run/rsync.pid ${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 condrestart() {
54         if [ -f /var/lock/subsys/rsyncd ]; then
55                 stop
56                 start
57         else
58                 msg_not_running rsyncd
59                 RETVAL=$1
60         fi
61 }
62
63 RETVAL=0
64 # See how we were called.
65 case "$1" in
66   start)
67         start
68         ;;
69   stop)
70         stop
71         ;;
72   restart)
73         stop
74         start
75         ;;
76   try-restart)
77         condrestart 0
78         ;;
79   force-reload)
80         condrestart 7
81         ;;
82   status)
83         status rsyncd rsync
84         exit $?
85         ;;
86   *)
87         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
88         exit 3
89 esac
90
91 exit $RETVAL
This page took 0.038045 seconds and 3 git commands to generate.