summaryrefslogtreecommitdiff
path: root/scripts/contrib
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-02-02 12:42:12 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-02 17:37:36 +0000
commit96a194de890f7ef1e6e5e036b32848e0f9d1bcf5 (patch)
tree6141fe73439d445684381c7f0400948160cad9ef /scripts/contrib
parentd0689f0357a34f1412b6365bcbd302f6b2e375a9 (diff)
downloadopenembedded-core-96a194de890f7ef1e6e5e036b32848e0f9d1bcf5.tar.gz
openembedded-core-96a194de890f7ef1e6e5e036b32848e0f9d1bcf5.tar.bz2
openembedded-core-96a194de890f7ef1e6e5e036b32848e0f9d1bcf5.zip
build-perf-test-wrapper.sh: implement locking
In order to prevent multiple instances of the script running at the same time. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-xscripts/contrib/build-perf-test-wrapper.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh
index e03ea978b9..a4c19290a7 100755
--- a/scripts/contrib/build-perf-test-wrapper.sh
+++ b/scripts/contrib/build-perf-test-wrapper.sh
@@ -67,6 +67,17 @@ if [ $# -ne 0 ]; then
exit 1
fi
+# Open a file descriptor for flock and acquire lock
+LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock"
+if ! exec 3> "$LOCK_FILE"; then
+ echo "ERROR: Unable to open lock file"
+ exit 1
+fi
+if ! flock -n 3; then
+ echo "ERROR: Another instance of this script is running"
+ exit 1
+fi
+
echo "Running on `uname -n`"
if ! git_topdir=$(git rev-parse --show-toplevel); then
echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`"