gackswatcher packaging for lxc
smbaker [Tue, 11 Sep 2012 04:47:16 +0000 (21:47 -0700)]
apps/gacks/Makefile
apps/gacks/gackswatcher-lxc.init [new file with mode: 0644]

index 19ad98f..3f2e13b 100644 (file)
@@ -20,3 +20,12 @@ gackswatcher-vserverrpm:
        cp gackswatcher-autorun.sh build/gackswatcher-vserver/autorun.sh
        chmod a+rwx build/gackswatcher-vserver/etc/init.d/gackswatcher
        ravenbuilder gackswatcher-vserver build/gackswatcher-vserver $(RPM_DIR)
+
+gackswatcher-vserverrpm:
+       mkdir -p build/gackswatcher-lxc/usr/share/gackswatcher
+       mkdir -p build/gackswatcher-lxc/etc/init.d
+       cp gackswatcher.py build/gackswatcher-lxc/usr/share/gackswatcher
+       cp gackswatcher-lxc.init build/gackswatcher-lxc/etc/init.d/gackswatcher
+       cp gackswatcher-autorun.sh build/gackswatcher-lxc/autorun.sh
+       chmod a+rwx build/gackswatcher-lxc/etc/init.d/gackswatcher
+       ravenbuilder gackswatcher-lxc build/gackswatcher-lxc $(RPM_DIR)
\ No newline at end of file
diff --git a/apps/gacks/gackswatcher-lxc.init b/apps/gacks/gackswatcher-lxc.init
new file mode 100644 (file)
index 0000000..6960911
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# gackswatcher      Starts gacks watcher
+#
+# chkconfig: 2345 95 35
+# description: Starts and stops gacks watcher
+#
+### BEGIN INIT INFO
+# Provides: $gackswatcher
+
+# Source function library.
+. /etc/init.d/functions
+
+if [ ! -f /usr/share/gackswatcher/gackswatcher.py ]; then
+   echo "missing /usr/share/gackswatcher/gackswatcher.py"
+   exit 0
+fi
+
+
+start() {
+       echo -n $"Starting gacks watcher: "
+        chmod u+x /usr/share/gackswatcher/gackswatcher.py
+        /usr/share/gackswatcher/gackswatcher.py --daemon monitor
+        echo
+}
+
+stop() {
+        echo -n $"Stopping gacks watcher: "
+        /usr/sbin/chcontext --ctx 1 pkill -f "gackswatcher.py"
+        echo
+        return 0
+}
+
+restart() {
+       stop
+       start
+}
+
+dump() {
+        /usr/sbin/chcontext --ctx 1 pkill -HUP -f "gackswatcher.py"
+}
+
+rhstatus() {
+        /usr/sbin/chcontext --ctx 1 pgrep -f "gackswatcher.py" > /dev/null
+        if [ $? == 0 ]; then
+            echo "running"
+        else
+            echo "not running"
+        fi
+}
+
+
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart|reload|condrestart)
+       restart
+       ;;
+  hup)
+        stop
+        ;;
+  dump)
+       dump
+       ;;
+  status)
+       rhstatus
+       ;;
+  *)
+       echo $"Usage: $0 {start|stop|restart|reload|condrestart|hup|dump|status}"
+       exit 1
+esac
+
+exit $?