summaryrefslogtreecommitdiff
path: root/debian/postinst
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-26 14:23:18 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-26 14:23:18 +0000
commit86ed15b1bb4cd25f355f8cd57db1cd7c89f27b56 (patch)
tree310d29509332c818ad5a783ae4ab756a9ec387a5 /debian/postinst
parent1c42f571300309f13760ec1e755775eb41ef6b54 (diff)
Added a post-installation script to restart the agents, after flushing
the queue, when we've upgraded.
Diffstat (limited to 'debian/postinst')
-rwxr-xr-xdebian/postinst37
1 files changed, 37 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000..c72c7ac
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Once we've installed the package explicitly flush the queue,
+# to cover cases when the format changes.
+#
+# If we're running @Bytemark restart the worker processes
+#
+
+set -e
+
+
+#
+# Skip, if we are not in "configure" state
+#
+if [ "$1" != "configure" ]; then
+ echo "I: Skipping configuration"
+ exit 0
+fi
+
+
+#
+# 1. Flush the queue
+#
+custodian-queue --flush || true
+
+#
+# 2. If we have agents then restart them
+#
+if [ -d /etc/service ]; then
+ test -d /etc/service/custodian-agent1 && sv restart /etc/service/custodian-agent1/
+ test -d /etc/service/custodian-agent2 && sv restart /etc/service/custodian-agent2/
+ test -d /etc/service/custodian-agent3 && sv restart /etc/service/custodian-agent3/
+ test -d /etc/service/custodian-agent4 && sv restart /etc/service/custodian-agent4/
+fi
+
+#DEBHELPER#
+exit 0