summaryrefslogtreecommitdiffstats
path: root/adei
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-02-22 00:51:18 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-02-22 00:51:18 +0100
commit28879b78ddff075daf9d28f6389ecab9909c1de8 (patch)
tree4817e399b31e425248831bf665b478ce75ea63ea /adei
parentdfe9895825ffbab23d9e8925b28282206d6678f8 (diff)
downloadadei-28879b78ddff075daf9d28f6389ecab9909c1de8.tar.gz
adei-28879b78ddff075daf9d28f6389ecab9909c1de8.tar.bz2
adei-28879b78ddff075daf9d28f6389ecab9909c1de8.tar.xz
adei-28879b78ddff075daf9d28f6389ecab9909c1de8.zip
Move locking protection from run-cron to adei-branch
Diffstat (limited to 'adei')
-rwxr-xr-xadei/scripts/adei-branch.sh13
-rwxr-xr-xadei/scripts/run-cron.sh10
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'