Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 475600 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/www-servers/varnish/files/varnishd.initd (-1 / +56 lines)
Lines 3-15 Link Here
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishd.initd,v 1.8 2013/03/14 12:18:17 blueness Exp $
4
# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishd.initd,v 1.8 2013/03/14 12:18:17 blueness Exp $
5
5
6
extra_commands="configtest"
7
extra_started_commands="reload"
8
9
description_configtest="Run syntax tests for configuration files."
10
description_reload="Reloads the configuration."
11
6
depend() {
12
depend() {
7
	need net
13
	need net
8
}
14
}
9
15
16
configtest() {
17
	ebegin "Checking ${SVCNAME} configuration"
18
	checkconfig
19
	eend $?
20
}
21
22
checkconfig() {
23
	${VARNISHD} -C -f ${CONFIGFILE} >/dev/null 2>&1
24
	ret=$?
25
	if [ $ret -ne 0 ]; then
26
		eerror "${SVCNAME} has detected an error in your setup:"
27
		${VARNISHD} -C -f ${CONFIGFILE}
28
	fi
29
30
	return $ret
31
}
32
10
start() {
33
start() {
34
	checkconfig || return 1
35
11
	ebegin "Starting varnish"
36
	ebegin "Starting varnish"
12
	start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec /usr/sbin/varnishd -- -P /var/run/varnishd.pid ${VARNISHD_OPTS} &> /dev/null
37
	start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec ${VARNISHD} -- -P /var/run/varnishd.pid ${VARNISHD_OPTS} &> /dev/null
13
	eend $?
38
	eend $?
14
39
15
	if [ "${VARNISHNCSA_ARGS}" != "" ]; then
40
	if [ "${VARNISHNCSA_ARGS}" != "" ]; then
Lines 30-32 Link Here
30
		eend $?
55
		eend $?
31
	fi
56
	fi
32
}
57
}
58
59
reload() {
60
	checkconfig || return 1
61
62
	ebegin "Reloading varnish"
63
64
	$VARNISHADM vcl.list >/dev/null 2>&1
65
	ret=$?
66
	if [ $ret -ne 0 ]; then
67
		eerror "${SVCNAME} cannot list configuration"
68
		return 1
69
	fi
70
71
	new_config="reload_$(date +%FT%H:%M:%S)"
72
	$VARNISHADM vcl.load $new_config $CONFIGFILE >/dev/null 2>&1
73
	ret=$?
74
	if [ $ret -ne 0 ]; then
75
		eerror "${SVCNAME} cannot load configuration"
76
		return 1
77
	fi
78
	
79
	$VARNISHADM vcl.use $new_config >/dev/null 2>&1
80
	ret=$?
81
	if [ $ret -ne 0 ]; then
82
		eerror "${SVCNAME} cannot switch configuration"
83
		return 1
84
	fi
85
86
	eend 0
87
}

Return to bug 475600