diff options
Diffstat (limited to 'tests/local-server/run_httpd')
-rwxr-xr-x | tests/local-server/run_httpd | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/local-server/run_httpd b/tests/local-server/run_httpd new file mode 100755 index 0000000..0df758e --- /dev/null +++ b/tests/local-server/run_httpd @@ -0,0 +1,44 @@ +#!/bin/sh + +HTTPD=/usr/sbin/apache2 +dir=`dirname $0` +ROOT=$dir/httpd +DOC_ROOT=$PWD +PID_FILE="$ROOT/httpd.pid" +PORT=8234 + +usage() { + me=`basename $0` + echo "$me: runs a local instance of apache (on port $PORT)" + echo "Usage: $me <start|stop|restart|reload|status> - the usual" + echo " $me log cat the log file" +} + +run_httpd() { + $HTTPD -d "$ROOT" -f etc/httpd.conf \ + -C "Listen $PORT" \ + -C "PidFile $PID_FILE" \ + -C "DocumentRoot $DOC_ROOT" \ + "$@" +} + +case "$1" in +start) shift; run_httpd "$@";; +stop) run_httpd -k stop;; +restart) + "$0" stop + sleep 1 + "$0" start + ;; +reload) kill -HUP `cat "$PID_FILE"`;; +status) + if [ -f "$PID_FILE" ]; then + ps `cat "$PID_FILE"` + else + echo "Not running" + fi + ;; +log) cat "$ROOT/logs/error_log";; +*) usage; exit 1;; +esac + |