aboutsummaryrefslogtreecommitdiff
path: root/www/lighttpd/files/lighttpd.sh.in
blob: 993fa3973ca1434ac4137ccfddef15d27710340e (plain) (blame)
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
58
59
60
61
62
63
64
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: lighttpd
# REQUIRE: %%REQUIRE%%
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable lighttpd:
#
# lighttpd_enable (bool):	Set it to "YES" to enable lighttpd
#				Default is "NO".
# lighttpd_conf (path):		Set full path to config file.
#				Default is "%%PREFIX%%/etc/lighttpd.conf".
# lighttpd_pidfile (path):	Set full path to pid file.
#				Default is "/var/run/lighttpd.pid".
#

. %%RC_SUBR%%

name="lighttpd"
rcvar=`set_rcvar`

load_rc_config $name

: ${lighttpd_enable="NO"}
: ${lighttpd_conf="%%PREFIX%%/etc/lighttpd.conf"}
: ${lighttpd_pidfile="/var/run/${name}.pid"}

command=%%PREFIX%%/sbin/lighttpd
command_args="-f ${lighttpd_conf}"
pidfile=${lighttpd_pidfile}
required_files=${lighttpd_conf}
stop_postcmd=stop_postcmd
restart_precmd="checkconfig"
reload_precmd=reload_precmd
reload_postcmd=reload_postcmd
sig_reload="-INT"
check_cmd="checkconfig"
extra_commands="reload check"

checkconfig()
{
	echo "Performing sanity check on ${name} configuration:"
	eval "${command} ${command_args} -t"
}

stop_postcmd()
{
	rm -f ${pidfile}
}

reload_precmd()
{
	echo "Stoping ${name} and start gracefully."
}

reload_postcmd()
{
	rm -f ${pidfile}
	run_rc_command start
}

run_rc_command "$1"