summaryrefslogtreecommitdiff
path: root/global/overlay/usr/local/bin/run-cosmos
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2015-03-22 01:12:40 +0100
committerLeif Johansson <leifj@sunet.se>2015-03-22 01:12:40 +0100
commit3a8ee7ace2bdd268d870fed9755fb91f21a10c5b (patch)
treea633960bce278f587ed5b4a29d54ffc529590d50 /global/overlay/usr/local/bin/run-cosmos
parent73bc205b46926c0b775e484b4f7d8c14611f0b8f (diff)
parentc04894515146e2e762d25abcff275c0d03dfe0c6 (diff)
Merge branch 'multiverse'
Conflicts: global/overlay/etc/puppet/cosmos-modules.conf
Diffstat (limited to 'global/overlay/usr/local/bin/run-cosmos')
-rwxr-xr-xglobal/overlay/usr/local/bin/run-cosmos22
1 files changed, 22 insertions, 0 deletions
diff --git a/global/overlay/usr/local/bin/run-cosmos b/global/overlay/usr/local/bin/run-cosmos
new file mode 100755
index 0000000..a37d49f
--- /dev/null
+++ b/global/overlay/usr/local/bin/run-cosmos
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Simplify running cosmos, with serialization if flock is available.
+#
+
+set -e
+
+FLOCK=`which flock`
+
+if [ -x "$FLOCK" ]; then
+ ($FLOCK --exclusive --wait 60 9 || exit 1
+ cosmos $* update
+ cosmos $* apply
+ )9>/var/lock/run-cosmos
+else
+ cosmos $* update
+ cosmos $* apply
+fi
+
+touch /var/run/last-cosmos-ok.stamp
+
+find /var/lib/puppet/reports/ -type f -mtime +10 | xargs rm -f