From d000b1adea71cc89f31d4509c135768ecc796ba3 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Mon, 5 May 2014 12:53:51 +0200 Subject: init --- global/overlay/usr/local/bin/run-cosmos | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 global/overlay/usr/local/bin/run-cosmos (limited to 'global/overlay/usr/local/bin/run-cosmos') diff --git a/global/overlay/usr/local/bin/run-cosmos b/global/overlay/usr/local/bin/run-cosmos new file mode 100755 index 0000000..df104b8 --- /dev/null +++ b/global/overlay/usr/local/bin/run-cosmos @@ -0,0 +1,20 @@ +#!/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 -- cgit v1.1