put port number in config/log filenames
authorWolfram Schneider <wosch@indexdata.dk>
Wed, 15 Oct 2014 11:00:50 +0000 (13:00 +0200)
committerWolfram Schneider <wosch@indexdata.dk>
Wed, 15 Oct 2014 11:00:50 +0000 (13:00 +0200)
This allow to us to run 2 apache servers at the same time, e.g.
one for local development and one for local tests.

test/Makefile
test/bin/apache-template-update
tools/apache2/jasmine-dev.template
tools/apache2/jasmine-dev.template-2.4

index d4597df..86fca10 100644 (file)
@@ -18,6 +18,7 @@ SCREENSHOT_WIDTH=     360 480 640 768 1024 1200 1440 2048
 PERL_SCRIPTS=  bin/bomb.pl
 TMP_DIR=       ./logs
 APACHE_HTTPD:= $(shell env PATH=$$PATH:/usr/sbin which apache2 httpd false | head -1 )
+APACHE_PORT ?= 4040
 
 all: check
 
@@ -27,7 +28,7 @@ clean:
 
 distclean: clean clean-tmp clean-error
        rm -rf node_modules
-       rm -f ${TMP_DIR}/jasmine-dev
+       rm -f ${TMP_DIR}/jasmine-dev*.conf
        rm -f libexec
        make -C./widgets $@
 
@@ -99,16 +100,17 @@ node_modules node-modules:
 
 apache-start:
        bin/apache-template-update
-       ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev
+       ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev-${APACHE_PORT}.conf
 
+APACHE_PID_FILE=${TMP_DIR}/mkws-jasmine-${APACHE_PORT}.pid 
 apache-stop:
-       @-if [ -e ${TMP_DIR}/mkws-jasmine.pid ]; then \
-          kill `cat ${TMP_DIR}/mkws-jasmine.pid`; \
+       @-if [ -e ${APACHE_PID_FILE} ]; then \
+          kill `cat ${APACHE_PID_FILE}`; \
        else \
           killall apache2 2> /dev/null; \
        fi
        @sleep 0.6
-       rm -f ${TMP_DIR}/mkws-jasmine.pid
+       rm -f ${APACHE_PID_FILE}
 
 help:
        @echo "make [ all | check | clean | distclean ]"
index 29024ab..db0c6e5 100755 (executable)
@@ -9,11 +9,12 @@ export APACHE_SERVER_ROOT=$(pwd)
 export APACHE_RUN_USER=$(whoami)
 export APACHE_RUN_GROUP=$(groups | awk '{ print $1 }')
 
-export APACHE_LOG_DIR=$APACHE_SERVER_ROOT/logs
-export APACHE_PID_FILE=$APACHE_LOG_DIR/mkws-jasmine.pid
-export APACHE_LOCK_FILE=$APACHE_LOG_DIR/accept.lock
 : ${APACHE_PORT=4040}; export APACHE_PORT
 
+export APACHE_LOG_DIR=$APACHE_SERVER_ROOT/logs
+export APACHE_PID_FILE=$APACHE_LOG_DIR/mkws-jasmine-${APACHE_PORT}.pid
+export APACHE_LOCK_FILE=$APACHE_LOG_DIR/accept-${APACHE_PORT}.lock
+
 export MKWS_ROOT=$(pwd)/..
 
 MKWS_OS=debian
@@ -47,7 +48,7 @@ else
     APACHE_MODULES="$MKWS_ROOT/tools/apache2/jasmine-dev.apache-modules.$MKWS_OS.conf"
 fi
 
-: ${MKWS_APACHE_FILE="$APACHE_LOG_DIR/jasmine-dev"}
+: ${MKWS_APACHE_FILE="$APACHE_LOG_DIR/jasmine-dev-${APACHE_PORT}.conf"}
 export APACHE_MODULES
 
 perl -npe 's,\${(.*?)},$ENV{$1},g; ' $MKWS_APACHE_TEMPLATE > $MKWS_APACHE_FILE.tmp
index 92e22cb..6d73893 100644 (file)
@@ -27,12 +27,12 @@ Include ${APACHE_MODULES}
     ServerAlias mkws-dev a.mkws.indexdata.com a.mkws-dev.indexdata.com mkws-dev.indexdata.com 127.0.0.1
 
     ServerAdmin webmaster@indexdata.com
-    ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error.log
-    CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access.log combined
+    ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-${APACHE_PORT}-error.log
+    CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-${APACHE_PORT}-access.log combined
 
     RewriteEngine on
     RewriteLogLevel 1
-    RewriteLog ${APACHE_LOG_DIR}/mkws-jasmine-rewrite.log 
+    RewriteLog ${APACHE_LOG_DIR}/mkws-jasmine-rewrite-${APACHE_PORT}.log 
 
     DocumentRoot ${MKWS_ROOT}/examples/htdocs
     Alias /tools/htdocs ${MKWS_ROOT}/tools/htdocs
index 3c0f626..5adc4ba 100644 (file)
@@ -24,8 +24,8 @@ Include ${APACHE_MODULES}
     ServerAlias mkws-dev a.mkws.indexdata.com a.mkws-dev.indexdata.com mkws-dev.indexdata.com 127.0.0.1
 
     ServerAdmin webmaster@indexdata.com
-    ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error.log
-    CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access.log combined
+    ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error-${APACHE_PORT}.log
+    CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access-${APACHE_PORT}.log combined
     LogLevel info rewrite:debug
 
     RewriteEngine on