summaryrefslogtreecommitdiff
path: root/global/overlay/usr/local/bin/run-cosmos
blob: df104b84275db1b8d0ff8d9533b4195240ff477e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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