#!/bin/sh -xe
-sudo cp gnt-monitor /etc/ganeti/
+sudo cp -v gnt-monitor /etc/ganeti/
+sudo gnt-cluster copyfile /etc/ganeti/gnt-monitor
+
+test -e /etc/default/gnt-monitor || cp -v default/gnt-monitor /etc/default/ && echo "# modify config here"
sudo gnt-cluster copyfile /etc/default/gnt-monitor
sudo cp init.d/gnt-monitor /etc/init.d/gnt-monitor
sudo gnt-cluster copyfile /etc/init.d/gnt-monitor
#sudo gnt-cluster command apt-get install psmisc
-sudo gnt-cluster command killall gnt-monitor
+#sudo gnt-cluster command killall -r gnt-monitor
sudo gnt-cluster command service gnt-monitor restart
-sudo gnt-cluster command service gnt-monitor status
+sudo gnt-cluster command 'ps ax | grep gnt-monitor'
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="Genti monitor to influxdb"
+DESC="Genti monitor"
NAME=gnt-monitor
DAEMON=/etc/ganeti/$NAME
-DAEMON_ARGS="--options args"
+DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+export DEBUG
+export INFLUX
+export INTERVAL
+export DC
+export RACK
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME --background
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks