summaryrefslogtreecommitdiff
path: root/global/overlay/usr/local
diff options
context:
space:
mode:
authorLeif Johansson <leifj@mnt.se>2015-02-23 20:01:18 +0100
committerLeif Johansson <leifj@mnt.se>2015-02-23 20:01:18 +0100
commit4567098da8d443b65b3c32a7406cd8ad07217ff8 (patch)
tree66ab8b88ea088efc6a83ad03e646e384dc2ff7df /global/overlay/usr/local
parent4f300ca63268f73a63e01f5528ecdc5e6f46d67e (diff)
parentcd2b67ff5a8e308dc701319c189d3f8fa9b5370e (diff)
Merge pull request #8 from fredrikt/master
merge from eduid
Diffstat (limited to 'global/overlay/usr/local')
-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