aboutsummaryrefslogtreecommitdiff
path: root/net/lighttpd/files/lighttpd.init
blob: 1d290063ef33c6f7dc57222370c2a363b387dac2 (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
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org

START=50
STOP=50

USE_PROCD=1
PROG=/usr/sbin/lighttpd

validate_conf() {
	$PROG -tt -f /etc/lighttpd/lighttpd.conf >/dev/null 2>&1 || {
		echo "validation failed"
		return 1
	}
}

start_service() {
	user_exists http || user_add http
	[ -d /var/log/lighttpd ] || {
		mkdir -m 0775 -p /var/log/lighttpd
		chgrp www-data /var/log/lighttpd
	}

	validate_conf || exit 1

	procd_open_instance
	procd_set_param command $PROG -D -f /etc/lighttpd/lighttpd.conf
	procd_close_instance
}

service_triggers() {
	procd_add_reload_interface_trigger loopback
	procd_add_reload_interface_trigger lan
}

reload_service() {
	# lighttpd graceful restart (SIGUSR1)
	procd_send_signal lighttpd '*' USR1
}

relog() {
	# lighttpd reopen log files (SIGHUP)
	procd_send_signal lighttpd '*' HUP
}

EXTRA_COMMANDS="relog"
EXTRA_HELP="	relog   Reopen log files (without reloading)"