summaryrefslogtreecommitdiff
path: root/www/apache22/files/apache.sh
blob: 2328b641673d2a1fc04651b4b156a2fb72fe7440 (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
56
57
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: apache.sh,v 1.4 2009/02/25 22:05:40 tron Exp $
#
# PROVIDE: apache
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# You will need to set some variables in /etc/rc.conf to start Apache:
#
# apache=YES

name="apache"

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

	rcvar=$name
	command="@PREFIX@/sbin/httpd"
	command_args="-k start"
	pidfile="@VARBASE@/run/httpd.pid"
	required_files="@PKG_SYSCONFDIR@/httpd.conf"
	extra_commands="reload"
	reload_cmd="$command -k graceful"

	load_rc_config $name
	run_rc_command "$1"
else
	ctl_command="@PREFIX@/sbin/apachectl"

	if [ ! -x ${ctl_command} ]; then
		return
	fi

	case "$1" in
	start)
		@ECHO@ "Starting ${name}."
		${ctl_command} start
		;;
	stop)
		@ECHO@ "Stopping ${name}."
		${ctl_command} stop
		;;
	reload)
		${ctl_command} graceful
		;;
	restart)
		"$0" stop
		sleep 10
		"$0" start
		;;
	*)
		${ctl_command} "$1"
		;;
	esac
fi