2006-02-23 16:26:10 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# /etc/rc.d/apache: start/stop/restart apache HTTP server
|
|
|
|
#
|
|
|
|
|
2015-06-27 15:54:55 +02:00
|
|
|
SSD=/sbin/start-stop-daemon
|
|
|
|
PROG=/usr/sbin/httpd
|
2022-02-12 19:39:31 +01:00
|
|
|
PID=/run/apache/httpd.pid
|
2015-06-27 15:54:55 +02:00
|
|
|
OPTS="-k start"
|
2014-03-01 18:30:36 +01:00
|
|
|
KEY=/etc/apache/server.key
|
|
|
|
CRT=/etc/apache/server.crt
|
2006-02-23 16:26:10 +01:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
start)
|
2015-06-27 15:54:55 +02:00
|
|
|
if [ ! -s $KEY -o ! -s $CRT ]; then
|
2006-02-24 19:42:01 +01:00
|
|
|
/usr/bin/mksslcert $KEY $CRT
|
2006-02-23 16:26:10 +01:00
|
|
|
fi
|
2022-02-12 19:39:31 +01:00
|
|
|
mkdir -p /run/apache
|
2015-06-27 15:54:55 +02:00
|
|
|
$SSD --start --pidfile $PID --exec $PROG -- $OPTS
|
2006-02-23 16:26:10 +01:00
|
|
|
;;
|
|
|
|
stop)
|
2015-06-27 15:54:55 +02:00
|
|
|
$SSD --stop --retry 10 --pidfile $PID
|
2006-02-23 16:26:10 +01:00
|
|
|
;;
|
|
|
|
restart)
|
2015-06-27 15:54:55 +02:00
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
$SSD --status --pidfile $PID
|
|
|
|
case $? in
|
|
|
|
0) echo "$PROG is running with pid $(cat $PID)" ;;
|
|
|
|
1) echo "$PROG is not running but the pid file $PID exists" ;;
|
|
|
|
3) echo "$PROG is not running" ;;
|
|
|
|
4) echo "Unable to determine the program status" ;;
|
|
|
|
esac
|
2006-02-23 16:26:10 +01:00
|
|
|
;;
|
|
|
|
*)
|
2015-06-27 15:54:55 +02:00
|
|
|
echo "usage: $0 [start|stop|restart|status]"
|
2006-02-23 16:26:10 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# End of file
|