-
Notifications
You must be signed in to change notification settings - Fork 0
/
swift-container.swift-container-auditor
62 lines (54 loc) · 1.37 KB
/
swift-container.swift-container-auditor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/sh
### BEGIN INIT INFO
# Provides: swift-container-auditor
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Swift container auditor server
# Description: Container auditor server for swift.
### END INIT INFO
set -e
SERVICE_NAME="swift-container-auditor"
DAEMON="/usr/bin/${SERVICE_NAME}"
DAEMON_ARGS="/etc/swift/container-server.conf"
PRINT_NAME="Swift countainer auditor"
SWIFT_USER=swift
SWIFT_GRP=swift
PID_FILE=/var/run/swift/${SERVICE_NAME}.pid
PID_DIR=`dirname $PID_FILE`
if ! [ -x "${DAEMON}" ] ; then
exit 0
fi
if ! [ -r "${DAEMON_ARGS}" ] ; then
echo "No configuration file found in ${DAEMON_ARGS}: exiting"
exit 0
fi
mkdir -p ${PID_DIR}
chown ${SWIFT_USER} ${PID_DIR}
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting ${PRINT_NAME}" "${SERVICE_NAME}"
start-stop-daemon --start --chuid ${SWIFT_USER}:${SWIFT_GRP} -b -m --pidfile $PID_FILE --exec ${DAEMON} -- ${DAEMON_ARGS}
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping ${PRINT_NAME}" "${SERVICE_NAME}"
start-stop-daemon --stop --oknodo --pidfile ${PID_FILE}
log_end_msg $?
;;
restart|force-reload|reload)
$0 stop
sleep 1
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0