~james-page/swift/daemon-test-fix

1 by Soren Hansen
Import current packaging.
1
#! /bin/sh
2
### BEGIN INIT INFO
3
# Provides:          swift-container-replicator
4
# Required-Start:    $remote_fs
5
# Required-Stop:     $remote_fs
6
# Default-Start:     2 3 4 5
7
# Default-Stop:      0 1 6
8
# Short-Description: Swift container replicator
9
# Description:       Container replicator for swift.
10
### END INIT INFO
11
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
12
set -e
13
14
SERVICE_NAME="swift-container-replicator"
15
DAEMON="/usr/bin/${SERVICE_NAME}"
16
DAEMON_ARGS="/etc/swift/container-server.conf"
17
PRINT_NAME="Swift countainer replicator"
18
SWIFT_USER=swift
19
SWIFT_GRP=swift
20
PID_FILE=/var/run/swift/${SERVICE_NAME}.pid
21
PID_DIR=`dirname $PID_FILE`
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
22
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
23
if ! [ -x "${DAEMON}" ] ; then
24
	exit 0 
25
fi
26
27
if ! [ -r "${DAEMON_ARGS}" ] ; then
28
	echo "No configuration file found in ${DAEMON_ARGS}: exiting"
29
	exit 0
30
fi
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
31
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
32
mkdir -p ${PID_DIR}
33
chown ${SWIFT_USER} ${PID_DIR}
1 by Soren Hansen
Import current packaging.
34
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
35
. /lib/lsb/init-functions
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
36
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
37
case "$1" in
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
38
start)
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
39
	log_daemon_msg "Starting ${PRINT_NAME}" "${SERVICE_NAME}"
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
40
	start-stop-daemon --start --chuid ${SWIFT_USER}:${SWIFT_GRP} -b -m --pidfile $PID_FILE --exec ${DAEMON} -- ${DAEMON_ARGS}
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
41
	log_end_msg $?
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
42
;;
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
43
stop)
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
44
	log_daemon_msg "Stopping ${PRINT_NAME}" "${SERVICE_NAME}"
45
	start-stop-daemon --stop --oknodo --pidfile ${PID_FILE}
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
46
	log_end_msg $?
47
;;
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
48
restart|force-reload|reload)
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
49
	$0 stop
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
50
	sleep 1
51
	$0 start
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
52
;;
53
status)
54
	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
55
;;
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
56
*)
5.1.20 by zigo at debian
Added default container-server.conf & object-server.conf files.
57
	echo "Usage: $0 {start|stop|restart|reload|force-reload}"
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
58
	exit 1
59
;;
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
60
esac
40 by Soren Hansen
Fix up some indentation in the init scripts, and finish adding status support to the rest of the init scripts (in the first go, I only looked at *.init)
61
5.1.10 by Thomas Goirand
Some more init.d script tweaks to be policy compliant.
62
exit 0