blob: 0df758eb4bf411b2a735f44743326c44aa499616 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
|