summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-01-14 09:33:17 +0200
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-01-14 09:37:17 +0200
commitff86900a765e69a06a12e7b88886cd96d7a69722 (patch)
tree588c5bc5d942f6bee7f0835210646ac426b587bd
parent5f2dab59ff6e70edf6ffbcd65fe64b487c4380c2 (diff)
downloadtrove-setup-ff86900a765e69a06a12e7b88886cd96d7a69722.tar.gz
Re-add remove-lorry-controller-from-lorry-crontab script
This is still referenced in the trove-setup Ansible scripts, so it shouldn't have been removed.
-rw-r--r--Makefile2
-rwxr-xr-xlibexecs/remove-lorry-controller-from-lorry-crontab22
2 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 134436b..0811116 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,8 @@ install:
ln -s /home/lorry/tarballs "${DESTDIR}/var/www/htdocs/tarballs"
ln -s /home/lorry/lc-status.html "${DESTDIR}/var/www/htdocs/lc-status.html"
ln -s /usr/share/lorry-controller/static/ "${DESTDIR}/var/www/htdocs/lc-static"
+ mkdir -p "${DESTDIR}/usr/libexec"
+ cp libexecs/* "${DESTDIR}/usr/libexec/"
mkdir -p "${DESTDIR}/usr/share/trove-setup"
cp -r share/* "${DESTDIR}/usr/share/trove-setup/"
diff --git a/libexecs/remove-lorry-controller-from-lorry-crontab b/libexecs/remove-lorry-controller-from-lorry-crontab
new file mode 100755
index 0000000..8fc6cf3
--- /dev/null
+++ b/libexecs/remove-lorry-controller-from-lorry-crontab
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Trove used to run a version of Lorry Controller that wasn't a
+# daemon, but instead was invoked once a minute from a crontab owned
+# by the lorry user. When we upgrade to a version of Lorry Controller
+# that does run as a daemon, we need to disable the cronjob. This
+# script does that.
+#
+# The lorry user crontab may contain other jobs, so we can't just
+# willy-nilly delete the whole crontab. Instead, we remove the
+# specific line. The line looks like this:
+#
+# */1 * * * * flock -x -n /home/lorry/lorry-controller-area/lockfile
+# -c lorry-controller --work-area=/home/lorry/lorry-controller-area
+# --log=syslog --log-level=info --html-file=/home/lorry/lc-status.html
+#
+# Except, of course, all on one line.
+
+
+crontab -l |
+grep -v -e '-c lorry-controller' |
+crontab -