aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2016-10-20 16:03:20 +0100
committerRenato Golin <renato.golin@linaro.org>2016-10-20 16:04:25 +0100
commit22e1027ab56054cdcadab6e92ee08a9f97a8d4fc (patch)
tree968bed44795aba588b987734171988abef314552
parent767231ccad0d70552e83db4239a90c738895f3c4 (diff)
[cron] anti-flog checks for previous PID
Change-Id: I27758be09fe3c9e1cd7e9f7e0de331dc4fad9594
-rwxr-xr-xhelpers/llvm-cron-build4
1 files changed, 3 insertions, 1 deletions
diff --git a/helpers/llvm-cron-build b/helpers/llvm-cron-build
index 9d2062b..d433903 100755
--- a/helpers/llvm-cron-build
+++ b/helpers/llvm-cron-build
@@ -32,7 +32,9 @@ if [ "$1" = "" ]; then
fi
# Make sure we're not already running
-if ps awwux | grep -v grep | grep -v $$ | grep "$BIN" > /dev/null; then
+PID=$$
+PREVPID=$((PID-1)) # Cron starts sh -c '$JOB'
+if ps awwux | grep -v grep | grep -v "$PID" | grep -v "$PREVPID" | grep "$BIN" > /dev/null; then
echo "Already running, won't flog" > "$err"
exit 1
fi