diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2018-02-22 03:47:37 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2018-02-22 03:47:37 +0100 |
commit | 2a32f59c055f76b3420726930a08a0a95474cc2c (patch) | |
tree | 75651f882b60fd485aa8004889ec128829ff9da8 /adei/scripts/run-apache.sh | |
parent | 28879b78ddff075daf9d28f6389ecab9909c1de8 (diff) | |
download | adei-2a32f59c055f76b3420726930a08a0a95474cc2c.tar.gz adei-2a32f59c055f76b3420726930a08a0a95474cc2c.tar.bz2 adei-2a32f59c055f76b3420726930a08a0a95474cc2c.tar.xz adei-2a32f59c055f76b3420726930a08a0a95474cc2c.zip |
Simplify and add uid to /etc/passwd on startup to keep getpwuid() happy
Diffstat (limited to 'adei/scripts/run-apache.sh')
-rwxr-xr-x | adei/scripts/run-apache.sh | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/adei/scripts/run-apache.sh b/adei/scripts/run-apache.sh index e7d894b..159a265 100755 --- a/adei/scripts/run-apache.sh +++ b/adei/scripts/run-apache.sh @@ -3,20 +3,27 @@ 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 + +function ised { +#Creates temporary file in the file folder +# sed -i'' "$@" + + tmp=$(mktemp) + fn="${@: -1}" + echo $fn + sed "$@" > "$tmp" + cat "$tmp" > "$fn" + + rm -f "$tmp" +} + #Keep 80 & 443 -#sed -i'' -re '/Listen/ { /(80|443)/!d }' /etc/apache2/listen.conf +#ised -re '/Listen/ { /(80|443)/!d }' /etc/apache2/listen.conf #if [ -n "$ADEI_PORTS" ]; then # for port in $ADEI_PORTS; do # [ $port -eq 80 ] && continue @@ -49,10 +56,10 @@ if [ -n "$APACHE_SERVERS" -a "$APACHE_SERVERS" -ne 0 ]; then min_spare=0 max_spare=0 fi - [ $start -eq 0 ] || sed -i'' -re "s/StartServers(.*)/StartServers $start/" /etc/apache2/server-tuning.conf - [ $limit -eq 0 ] || sed -i'' -re "s/MaxClients(.*)/MaxClients $limit/" /etc/apache2/server-tuning.conf - [ $min_spare -eq 0 ] || sed -i'' -re "s/MinSpareServers(.*)/MinSpareServers $min_spare/" /etc/apache2/server-tuning.conf - [ $max_spare -eq 0 ] || sed -i'' -re "s/MaxSpareServers(.*)/MaxSpareServers $max_spare/" /etc/apache2/server-tuning.conf + [ $start -eq 0 ] || ised -re "s/StartServers(.*)/StartServers $start/" /etc/apache2/server-tuning.conf + [ $limit -eq 0 ] || isedt -re "s/MaxClients(.*)/MaxClients $limit/" /etc/apache2/server-tuning.conf + [ $min_spare -eq 0 ] || ised -re "s/MinSpareServers(.*)/MinSpareServers $min_spare/" /etc/apache2/server-tuning.conf + [ $max_spare -eq 0 ] || ised -re "s/MaxSpareServers(.*)/MaxSpareServers $max_spare/" /etc/apache2/server-tuning.conf fi rm -f /tmp/httpd.pid |