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