You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-emulation/ganeti/files/ganeti2.initd

56 lines
1.4 KiB

#!/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
}