summaryrefslogtreecommitdiff
path: root/www/apache/files/apache.sh
blob: 28a3df9d5f43795d60de64edda5ef51ec97c8d31 (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: apache.sh,v 1.26 2005/02/28 23:30:49 abs Exp $
#
# PROVIDE: apache
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# You will need to set some variables in /etc/rc.conf to start Apache:
#
# apache=YES 
# apache_start="start"  # set to "startssl" to allow HTTPS connections
#			# if ap-ssl is installed; this variable is optional

if [ -f /etc/rc.subr ]
then
	. /etc/rc.subr
fi

name="apache"
rcvar=$name
command="@PREFIX@/sbin/httpd"
ctl_command="@PREFIX@/sbin/apachectl"
required_files="@PKG_SYSCONFDIR@/httpd.conf"
extra_commands="reload"
start_cmd="apache_doit start"
stop_cmd="apache_doit stop"
restart_cmd="apache_doit restart"
reload_cmd="apache_doit reload"

apache_doit ()
{
	: ${apache_start:=start}

	case $1 in
	start)	action=${apache_start} ;;
	restart)action=re${apache_start} ;;	# For apache_start=startssl
	reload)	action=graceful ;;
	*)	action=$1 ;;
	esac
	${ctl_command} ${action}
}

if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
then
	load_rc_config $name
	run_rc_command "$1"
else
	apache_doit "$1"
fi