diff options
Diffstat (limited to 'app-emulation/ganeti/files/ganeti2.initd')
-rw-r--r-- | app-emulation/ganeti/files/ganeti2.initd | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/app-emulation/ganeti/files/ganeti2.initd b/app-emulation/ganeti/files/ganeti2.initd new file mode 100644 index 00000000000..74a748a73e3 --- /dev/null +++ b/app-emulation/ganeti/files/ganeti2.initd @@ -0,0 +1,55 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need localmount drbd + after bootmisc +} + +checkconfig() { + for fname in /var/lib/ganeti/server.pem + do + if [[ ! -f "$fname" ]] + then + eerror "Config file $fname not found, will not run." + return 1 + fi + done + + return 0 +} + +start_action() { + # called as start_action daemon pidfile + local daemon="${1}"; shift + local pidfile="${1}"; shift + ebegin "Starting ${daemon}" + start-stop-daemon --start --quiet --exec "${daemon}" --pidfile "${pidfile}" \ + -- "${@}" + eend ${?} +} + +stop_action() { + # called as stop_action daemon pidfile + ebegin "Stopping ${1}" + start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile "${2}" + eend ${?} +} + + +start() { + checkconfig || return 1 + start_action /usr/sbin/ganeti-noded /var/run/ganeti/ganeti-noded.pid + start_action /usr/sbin/ganeti-masterd /var/run/ganeti/ganeti-masterd.pid + start_action /usr/sbin/ganeti-rapi /var/run/ganeti/ganeti-rapi.pid + return 0 +} + +stop() { + stop_action /usr/sbin/ganeti-rapi /var/run/ganeti/ganeti-rapi.pid + stop_action /usr/sbin/ganeti-masterd /var/run/ganeti/ganeti-masterd.pid + stop_action /usr/sbin/ganeti-noded /var/run/ganeti/ganeti-noded.pid + return 0 +} |