40.2.1
by Ryan Finnie
Add Debian init.d example |
1 |
#! /bin/sh
|
2 |
||
3 |
### BEGIN INIT INFO
|
|
4 |
# Provides: turku-agent-rsyncd
|
|
5 |
# Required-Start: $remote_fs $syslog
|
|
6 |
# Required-Stop: $remote_fs $syslog
|
|
7 |
# Should-Start: $named
|
|
8 |
# Default-Start: 2 3 4 5
|
|
9 |
# Default-Stop:
|
|
10 |
# Short-Description: turku rsync daemon
|
|
11 |
# Description: turku rsync daemon
|
|
12 |
### END INIT INFO
|
|
13 |
||
14 |
set -e
|
|
15 |
||
16 |
PID_FILE=/var/run/turku-agent-rsyncd.pid |
|
17 |
||
18 |
. /lib/lsb/init-functions |
|
19 |
||
20 |
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|
21 |
||
22 |
case "$1" in |
|
23 |
start)
|
|
24 |
log_daemon_msg "Starting turku rsync daemon" "turku-agent-rsyncd" |
|
25 |
start-stop-daemon --start --quiet --background --make-pidfile \
|
|
26 |
--pidfile $PID_FILE --exec /usr/bin/env -- turku-agent-rsyncd-wrapper
|
|
27 |
log_end_msg $?
|
|
28 |
;;
|
|
29 |
stop)
|
|
30 |
log_daemon_msg "Stopping turku rsync daemon" "turku-agent-rsyncd" |
|
31 |
start-stop-daemon --stop --quiet --oknodo --pidfile $PID_FILE --retry 5 |
|
32 |
log_end_msg $?
|
|
33 |
rm -f $PID_FILE
|
|
34 |
;;
|
|
35 |
||
36 |
reload|force-reload) |
|
37 |
log_daemon_msg "Reloading turku rsync daemon" "turku-agent-rsyncd" |
|
38 |
log_end_msg 0
|
|
39 |
;;
|
|
40 |
||
41 |
restart)
|
|
42 |
"$0" stop |
|
43 |
"$0" start |
|
44 |
;;
|
|
45 |
||
46 |
status)
|
|
47 |
status_of_proc -p $PID_FILE rsync turku-agent-rsyncd
|
|
48 |
exit $? # notreached due to set -e |
|
49 |
;;
|
|
50 |
*)
|
|
51 |
echo "Usage: /etc/init.d/turku-agent-rsyncd {start|stop|reload|force-reload|restart|status}" |
|
52 |
exit 1 |
|
53 |
esac
|
|
54 |
||
55 |
exit 0 |