summaryrefslogtreecommitdiff
blob: 488cc819d0df3fc9e74ea4fbac1209a957a1a869 (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
58
59
60
61
62
63
64
65
66
67
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

command="/usr/sbin/cherokee"
extra_commands="configtest"
extra_started_commands="graceful reload"


depend() {
	need net
	use dns ldap logger mysql netmount
}

checkconfig() {
	${command} -t 1>/dev/null 2>&1
	ret=$?
	if [ $ret -ne 0 ]; then
		eerror "${SVCNAME} has detected an error in your config:"
		${command} -t ${CHEROKEE_OPTS}
	fi
	return $?
}

configtest() {
	ebegin "Checking ${SVCNAME} configuration"
	checkconfig
	eend $?
}

start() {
	checkconfig || return 1

	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start --quiet \
		--exec ${command} -- -d ${CHEROKEE_OPTS}
	eend $?
}

stop() {
	checkconfig || return 1

	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --quiet \
		--exec ${command}
	eend $?
}

graceful() {
	checkconfig || return 1

	ebegin "Restarting ${SVCNAME} and closing all the opened connections"
	start-stop-daemon \
		--exec ${command} \
		--signal USR1
	eend $?
}

reload() {
	checkconfig || return 1

	ebegin "Reloading ${SVCNAME} configuration"
	start-stop-daemon \
		--exec ${command} \
		--signal HUP
	eend $?
}