diff options
Diffstat (limited to 'adei/scripts')
-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 |