summaryrefslogtreecommitdiff
path: root/www/apache/files/apache.sh
blob: a7f00f27aa0db4495f2697a3f66db65ae1671a2a (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
45
46
47
48
49
50
51
52
53
54
55
#! /bin/sh
#
# $NetBSD: apache.sh,v 1.11 2001/04/29 20:42:29 jlam Exp $
#
# PROVIDE: apache
# REQUIRE: DAEMON

name="apache"
ctl_command="@PREFIX@/sbin/apachectl"
command="@PREFIX@/sbin/httpd"
pidfile="/var/run/httpd.pid"

apache_start="start"

if [ -f @APACHE_SYSCONFDIR@/apache_start.conf ]
then
	# This file can reset apache_start to "startssl"
	. @APACHE_SYSCONFDIR@/apache_start.conf
fi

cmd=${1:-start}

if [ -x ${ctl_command} -a -x ${command} ]
then
	case ${cmd} in
	start)
		echo "Starting ${name}."
		${ctl_command} ${apache_start} > /dev/null
		;;

	stop)
		if [ -f ${pidfile} ]
		then
			echo "Stopping ${name}."
			${ctl_command} ${cmd} > /dev/null
		fi
		;;

	restart)
		( $0 stop )
		sleep 5
		$0 start
		;;

	status)
		${ctl_command} ${cmd}
		;;

	*)
		echo 1>&2 "Usage: $0 [restart|start|stop|status]"
		exit 1
		;;
	esac
fi
exit 0