sysv init now really works
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 8 Dec 2016 20:02:55 +0000 (21:02 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 8 Dec 2016 20:02:55 +0000 (21:02 +0100)
bin/install-sysv.sh
init.d/gnt-monitor

index ef2f41a..20401e0 100755 (executable)
@@ -1,12 +1,15 @@
 #!/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'
index fbff8f4..6a7a827 100755 (executable)
 
 # 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
 
@@ -31,6 +31,11 @@ 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
@@ -69,7 +74,7 @@ do_stop()
        #   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