Commit 9bd7f742 authored by Iustin Pop's avatar Iustin Pop
Browse files

Update the init script to start both the node daemon and the master.

Reviewed-by: imsnah
parent dcb93971
......@@ -3,14 +3,13 @@
# based on skeleton from Debian GNU/Linux
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
DAEMON=/usr/local/sbin/ganeti-noded
NODED=/usr/local/sbin/ganeti-noded
MASTER=/usr/local/sbin/ganeti-master
NAME=ganeti-noded
SCRIPTNAME=/etc/init.d/ganeti
DESC="Ganeti node daemon"
DESC="Ganeti cluster"
test -f $DAEMON || exit 0
set -e
test -f $NODED || exit 0
. /lib/lsb/init-functions
......@@ -24,24 +23,51 @@ check_config() {
done
}
master_action() {
log_action_begin_msg "ganeti-master"; $MASTER "$1"
RC=$?
case $RC in
0)
log_action_end_msg 0
;;
11)
log_action_end_msg 0 "not master"
;;
*)
log_action_end_msg 1 "exit code $RC"
;;
esac
}
case "$1" in
start)
log_begin_msg "Starting $DESC..."
log_daemon_msg "Starting $DESC" "$NAME"
check_config
start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
if start-stop-daemon --start --quiet --exec $NODED; then
log_end_msg 0
else
log_end_msg 1
fi
master_action start
;;
stop)
log_begin_msg "Stopping $DESC..."
start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --stop --quiet --name $NAME; then
log_end_msg 0
else
log_end_msg 1
fi
master_action stop
;;
restart|force-reload)
log_begin_msg "Reloading $DESC..."
log_daemon_msg "Reloading $DESC"
start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
check_config
start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
log_end_msg 0
start-stop-daemon --start --quiet --exec $NODED
log_end_msg $?
$MASTER stop
master_action start
;;
*)
log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment