summaryrefslogtreecommitdiff
path: root/www/apache2/files/apache.sh
blob: 22b785949d85feaed87e21a36046e49db58aeaf9 (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
#!/bin/sh
#
# $NetBSD: apache.sh,v 1.3 2002/04/13 21:35:51 jlam Exp $
#
# PROVIDE: apache
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# To start apache at startup, copy this script to /etc/rc.d and set
# apache=YES in /etc/rc.conf.

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"
start_cmd="apache_doit start"
stop_cmd="apache_doit stop"
restart_cmd="apache_doit restart"

# "${apache_start}" is the subcommand sent to apachectl to control how
# httpd is started.  It's value may be overridden in:
#
#	/etc/rc.conf
#	/etc/rc.conf.d/apache,
#
# in order of increasing precedence.  Its possible values are "start"
# and "startssl", and defaults to "start".
#
apache_start=start

apache_doit ()
{
	case $1 in
	start)	action=${apache_start} ;;
	*)	action=$1 ;;
	esac
	${ctl_command} ${action}
}

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