summaryrefslogtreecommitdiffstats
path: root/adei/scripts/run-apache.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-02-21 18:44:26 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-02-21 18:44:26 +0100
commit350abf69de17b079c7589022bb0b2df01a51f84e (patch)
tree66bba94094c096b21c181d1a77c6a4ca4078482d /adei/scripts/run-apache.sh
parent3d19ce5671e45b8e06a91cb09065d81e22f9d6fd (diff)
downloadadei-350abf69de17b079c7589022bb0b2df01a51f84e.tar.gz
adei-350abf69de17b079c7589022bb0b2df01a51f84e.tar.bz2
adei-350abf69de17b079c7589022bb0b2df01a51f84e.tar.xz
adei-350abf69de17b079c7589022bb0b2df01a51f84e.zip
Use volume for apache configuration in order to run in read-only containers
Diffstat (limited to 'adei/scripts/run-apache.sh')
-rwxr-xr-xadei/scripts/run-apache.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/adei/scripts/run-apache.sh b/adei/scripts/run-apache.sh
index 3ad9d5f..90438a7 100755
--- a/adei/scripts/run-apache.sh
+++ b/adei/scripts/run-apache.sh
@@ -1,8 +1,19 @@
#! /bin/bash
-if [ ! -f /adei/cfg/apache.conf ]; then
- cp -a /opt/configs/apache* /adei/cfg
-fi
+LOCK_FILE=.lock
+(
+ flock -x 10
+ if [ ! -d /adei/ovr/apache2 ]; then
+ cp -ar /opt/apache2 /adei/ovr/
+ fi
+) 10> /adei/ovr/$LOCK_FILE
+
+(
+ flock -x 10
+ if [ ! -f /adei/cfg/apache.conf ]; then
+ cp -a /opt/configs/apache* /adei/cfg
+ fi
+) 10> /adei/cfg/$LOCK_FILE
sed -i'' -re '/Listen/ { /(80|443)/!d }' /etc/apache2/listen.conf
if [ -n "$ADEI_PORTS" ]; then