From dd19d5b290d6dfd86b6087d45d7bcb72ff57417a Mon Sep 17 00:00:00 2001 From: SirWalross <27106448+SirWalross@users.noreply.github.com> Date: Sun, 12 Jun 2022 22:41:33 +0200 Subject: [PATCH] Add lock to only execute pull.bash only once at a time --- .gitignore | 2 -- scripts/pull.bash | 6 ++++++ scripts/push.bash | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6d0e360..6a69604 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ *.txt out/* CHANGELOG.md -data/data -logs/log profiling.log \ No newline at end of file diff --git a/scripts/pull.bash b/scripts/pull.bash index 66b149f..5e05b0c 100755 --- a/scripts/pull.bash +++ b/scripts/pull.bash @@ -1,5 +1,11 @@ #!/bin/bash +# wait until all other instances of the script are finished +while pidof -o %PPID -x "pull.bash">/dev/null; do + # check every 60 seconds + sleep 60 +done + cd `dirname "$0"`/.. echo $( date '+%F %H:%M:%S' ) | tee -a bash.log git pull 2>&1 | tee -a bash.log diff --git a/scripts/push.bash b/scripts/push.bash index 70a91e6..9775700 100755 --- a/scripts/push.bash +++ b/scripts/push.bash @@ -2,11 +2,12 @@ ls -la . ls -la data -ls -la log +ls -la logs +ps aux scripts/./write.bash -pip install multiprocessing_logging +pip3 install multiprocessing_logging python3 measure.py git add . -- GitLab