/admin/docker

To get this branch, use:
bzr branch http://darksoft.org/webbzr/admin/docker

« back to all changes in this revision

Viewing changes to adei/adei/scripts/run-apache.sh

  • Committer: Suren A. Chilingaryan
  • Date: 2016-12-23 19:40:10 UTC
  • Revision ID: csa@suren.me-20161223194010-1013mnipk5revl6m
Initial release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
 
 
3
if [ ! -f /adei/cfg/apache.conf ]; then
 
4
    cp -a /opt/configs/apache* /adei/cfg
 
5
fi
 
6
 
 
7
sed -i'' -re '/Listen/ { /(80|443)/!d }' /etc/apache2/listen.conf
 
8
if [ -n "$ADEI_PORTS" ]; then
 
9
    for port in $ADEI_PORTS; do
 
10
        [ $port -eq 80 ] && continue
 
11
        [ $port -eq 443 ] && continue
 
12
        
 
13
        echo "Listen $port" >> /etc/apache2/listen.conf
 
14
    done
 
15
fi
 
16
 
 
17
if [ -n "$APACHE_SERVERS" -a "$APACHE_SERVERS" -ne 0 ]; then
 
18
    if [ $APACHE_SERVERS -eq 1 ]; then
 
19
        start=1
 
20
        limit=1
 
21
        min_spare=1
 
22
        max_spare=1
 
23
    elif [ $APACHE_SERVERS -lt 10 ]; then
 
24
        start=$(($APACHE_SERVERS / 2))
 
25
        limit=$APACHE_SERVERS
 
26
        min_spare=$start
 
27
        max_spare=$limit
 
28
    else
 
29
        start=0
 
30
        limit=$APACHE_SERVERS
 
31
        min_spare=0
 
32
        max_spare=0
 
33
    fi
 
34
    [ $start -eq 0 ] || sed -i'' -re "s/StartServers(.*)/StartServers $start/" /etc/apache2/server-tuning.conf
 
35
    [ $limit -eq 0 ] || sed -i'' -re "s/MaxClients(.*)/MaxClients $limit/" /etc/apache2/server-tuning.conf
 
36
    [ $min_spare -eq 0 ] || sed -i'' -re "s/MinSpareServers(.*)/MinSpareServers $min_spare/" /etc/apache2/server-tuning.conf
 
37
    [ $max_spare -eq 0 ] || sed -i'' -re "s/MaxSpareServers(.*)/MaxSpareServers $max_spare/" /etc/apache2/server-tuning.conf
 
38
fi
 
39
 
 
40
/usr/sbin/apache2ctl start -D FOREGROUND