[tor-commits] [tor-browser-bundle-testsuite] 01/02: Bug 40045: Add lock on tools/tb-build-01-start-nightly-build

gitolite role git at cupani.torproject.org
Tue Apr 26 19:45:46 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch master
in repository tor-browser-bundle-testsuite.

commit 5add3079e5448f7ce6853ed9e687f53c476df39f
Author: Nicolas Vigier <boklm at torproject.org>
AuthorDate: Mon Apr 25 11:07:51 2022 +0200

    Bug 40045: Add lock on tools/tb-build-01-start-nightly-build
---
 tools/tb-build-01-start-nightly-build | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/tb-build-01-start-nightly-build b/tools/tb-build-01-start-nightly-build
index 1d693e0..9dfb952 100755
--- a/tools/tb-build-01-start-nightly-build
+++ b/tools/tb-build-01-start-nightly-build
@@ -1,6 +1,26 @@
 #!/bin/bash
 set -e
 
+function getlock {
+  lockfile=/run/lock/tb-build-01-start-nightly-build.lock
+  if test -f $lockfile
+  then
+    old_pid=$(cat $lockfile)
+    if test -z "$old_pid" || ! test -d "/proc/$old_pid"
+    then
+      echo "Removing old lockfile: $lockfile"
+      rm -f $lockfile
+    else
+      echo "Script already running. Exiting." 1>&2
+      exit 0
+    fi
+  fi
+  echo $$ > $lockfile
+  trap "rm -f $lockfile" EXIT
+}
+
+getlock
+
 today_version=$(date '+tbb-nightly.%Y.%m.%d')
 
 cd /home/tb-builder/tor-browser-bundle-testsuite

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list