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 @@ ...@@ -3,14 +3,13 @@
# based on skeleton from Debian GNU/Linux # based on skeleton from Debian GNU/Linux
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin 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 NAME=ganeti-noded
SCRIPTNAME=/etc/init.d/ganeti SCRIPTNAME=/etc/init.d/ganeti
DESC="Ganeti node daemon" DESC="Ganeti cluster"
test -f $DAEMON || exit 0 test -f $NODED || exit 0
set -e
. /lib/lsb/init-functions . /lib/lsb/init-functions
...@@ -24,25 +23,52 @@ check_config() { ...@@ -24,25 +23,52 @@ check_config() {
done 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 case "$1" in
start) start)
log_begin_msg "Starting $DESC..." log_daemon_msg "Starting $DESC" "$NAME"
check_config 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 log_end_msg 0
else
log_end_msg 1
fi
master_action start
;; ;;
stop) stop)
log_begin_msg "Stopping $DESC..." log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1 if start-stop-daemon --stop --quiet --name $NAME; then
log_end_msg 0 log_end_msg 0
else
log_end_msg 1
fi
master_action stop
;; ;;
restart|force-reload) restart|force-reload)
log_begin_msg "Reloading $DESC..." log_daemon_msg "Reloading $DESC"
start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
check_config check_config
start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1 start-stop-daemon --start --quiet --exec $NODED
log_end_msg 0 log_end_msg $?
;;
$MASTER stop
master_action start
;;
*) *)
log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}" log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
exit 1 exit 1
......
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