summaryrefslogtreecommitdiff
blob: b115c484187ca5f0342b01c50fb535c86831b667 (plain)
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
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
	need net
}

BASENAME=$(echo $SVCNAME | cut -d '-' -f 1)

checkconfig() {
	if [ ! -r /etc/conf.d/$BASENAME ]; then
		eerror "No nova flagfile found: /etc/conf.d/$BASENAME)"
		return 1
	fi
	if [ ${SVCNAME} == "nova-api" ]; then
		if [ ! -r /etc/nova/api-paste.ini ]; then
			eerror "No api-paste file found: /etc/nova/api-paste.ini)"
			return 1
		fi
	fi
	return 0
}


start() {
	checkconfig || return $?
	. /etc/conf.d/$BASENAME
	
	ebegin "Starting ${SVCNAME}"

	export TMPDIR=${NOVA_TMP_PATH}
	start-stop-daemon --start --quiet --make-pidfile --pidfile "${PID_PATH}/${SVCNAME}.pid" \
					  --exec /usr/bin/${SVCNAME} --background -- --flagfile=${FLAG_FILE} \
					  --logfile=${LOG_PATH}/${SVCNAME}.log
	
	eend $? "Failed to start ${SVCNAME}"
}

stop() {
	checkconfig || return $?
	. /etc/conf.d/$BASENAME
	
	ebegin "Stopping ${SVCNAME}"
	
	start-stop-daemon --stop --pidfile "${PID_PATH}/${SVCNAME}.pid" \
					  --exec /usr/bin/${SVCNAME} 
	eend $? "Failed to stop ${SVCNAME}"
}

#restart() {
#
#}