From 28879b78ddff075daf9d28f6389ecab9909c1de8 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 22 Feb 2018 00:51:18 +0100 Subject: Move locking protection from run-cron to adei-branch --- adei/scripts/adei-branch.sh | 13 +++++++++---- adei/scripts/run-cron.sh | 10 +--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/adei/scripts/adei-branch.sh b/adei/scripts/adei-branch.sh index 6fa8db2..5f14c01 100755 --- a/adei/scripts/adei-branch.sh +++ b/adei/scripts/adei-branch.sh @@ -10,8 +10,12 @@ if [ ! -d /adei/src -o ! -d /adei/tmp -o ! -d /adei/sys -o ! -d /adei/cfg ]; th exit 1 fi +LOCK_FILE=.lock +( + flock -x 10 + flock -x 11 -if [ ! -f /adei/src/VERSION ]; then + if [ ! -f /adei/src/VERSION ]; then bzr branch -r $ADEI_REVISION --use-existing-dir http://darksoft.org/bzr/adei/trunk/ /adei/src ( cd /adei/src @@ -33,9 +37,9 @@ if [ ! -f /adei/src/VERSION ]; then ln -s ../cfg/config.actual.php config.actual.php ln -s ../cfg/config.override.php config.override.php ) -fi + fi -( + ( cd /adei/src for setup in $ADEI_ENABLED_SETUPS $ADEI_SETUP; do if [[ ! -a setups/$setup ]]; then @@ -48,4 +52,5 @@ fi ln -s ../../cfg/$setup setups/$setup fi done -) + ) +) 10> /adei/cfg/$LOCK_FILE 11> /adei/src/$LOCK_FILE diff --git a/adei/scripts/run-cron.sh b/adei/scripts/run-cron.sh index f0539f6..5f4b9e2 100755 --- a/adei/scripts/run-cron.sh +++ b/adei/scripts/run-cron.sh @@ -2,14 +2,6 @@ printenv | grep -v affinity:container | sed -r 's/^(.*)=("?)(.*)\2$/export \1="\3"/g' > /adei/env -LOCK_FILE=.lock -( - flock -x 10 - flock -x 11 - - /opt/scripts/adei-branch.sh - -) 10> /adei/cfg/$LOCK_FILE 11> /adei/src/$LOCK_FILE - +/opt/scripts/adei-branch.sh cron -n -m '/usr/bin/procmail -d root' -- cgit v1.2.1