Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 480252
Collapse All | Expand All

(-)varnishd (-8 / +28 lines)
Lines 9-14 Link Here
9
description_configtest="Run syntax tests for configuration files."
9
description_configtest="Run syntax tests for configuration files."
10
description_reload="Reloads the configuration."
10
description_reload="Reloads the configuration."
11
11
12
CONF="${SVCNAME#*.}"
13
CONFBASE="/etc/conf.d/varnishd"
14
[ -z "${PIDBASE}" ] && PIDBASE="/var/run/varnishd"
15
[ "${CONF}" = "varnishd" ] && CONF=''
16
17
if [ -n "${CONF}" ]; then
18
	PIDFILE="${PIDBASE}.${CONF}.pid"
19
	CONFSRC="${CONFBASE}.${CONF}"
20
	INSTANCE="${CONF}"
21
	if [ -f "${CONFSRC}" ]; then
22
	 . "${CONFSRC}"
23
	else
24
	 eerror "The configuration file $CONFSRC was not found!"
25
	fi
26
else
27
	PIDFILE="${PIDBASE}.pid"
28
	CONFSRC="${CONFBASE}"
29
	INSTANCE="${HOSTNAME}"
30
fi
31
12
depend() {
32
depend() {
13
	need net
33
	need net
14
}
34
}
Lines 34-57 Link Here
34
	checkconfig || return 1
54
	checkconfig || return 1
35
55
36
	ebegin "Starting varnish"
56
	ebegin "Starting varnish"
37
	start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec ${VARNISHD} -- -P /var/run/varnishd.pid ${VARNISHD_OPTS} &> /dev/null
57
	start-stop-daemon --quiet --start --pidfile ${PIDFILE} --exec ${VARNISHD} -- -n ${INSTANCE} -P ${PIDFILE} ${VARNISHD_OPTS} &> /dev/null
38
	eend $?
58
	eend $?
39
59
40
	if [ "${VARNISHNCSA_ARGS}" != "" ]; then
60
	if [ "${VARNISHNCSA_ARGS}" != "" ]; then
41
		ebegin "Starting varnish logging"
61
		ebegin "Starting varnish logging"
42
		start-stop-daemon --quiet --start --pidfile /var/run/varnishncsa.pid --exec /usr/bin/varnishncsa -- -D -P /var/run/varnishncsa.pid ${VARNISHNCSA_ARGS}
62
		start-stop-daemon --quiet --start --pidfile ${PIDFILE}.ncsa --exec /usr/bin/varnishncsa -- -n ${INSTANCE} -D -P ${PIDFILE}.ncsa ${VARNISHNCSA_ARGS}
43
		eend $?
63
		eend $?
44
	fi
64
	fi
45
}
65
}
46
66
47
stop() {
67
stop() {
48
	ebegin "Stopping varnish"
68
	ebegin "Stopping varnish"
49
	start-stop-daemon --quiet --stop --pidfile /var/run/varnishd.pid
69
	start-stop-daemon --quiet --stop --pidfile ${PIDFILE}
50
	eend $?
70
	eend $?
51
71
52
	if [ -e /var/run/varnishncsa.pid ]; then
72
	if [ -e ${PIDFILE}.ncsa ]; then
53
		ebegin "Stopping varnish logging"
73
		ebegin "Stopping varnish logging"
54
		start-stop-daemon --quiet --stop --pidfile /var/run/varnishncsa.pid
74
		start-stop-daemon --quiet --stop --pidfile ${PIDFILE}.ncsa
55
		eend $?
75
		eend $?
56
	fi
76
	fi
57
}
77
}
Lines 61-67 Link Here
61
81
62
	ebegin "Reloading varnish"
82
	ebegin "Reloading varnish"
63
83
64
	$VARNISHADM vcl.list >/dev/null 2>&1
84
	$VARNISHADM -n ${INSTANCE} vcl.list >/dev/null 2>&1
65
	ret=$?
85
	ret=$?
66
	if [ $ret -ne 0 ]; then
86
	if [ $ret -ne 0 ]; then
67
		eerror "${SVCNAME} cannot list configuration"
87
		eerror "${SVCNAME} cannot list configuration"
Lines 69-82 Link Here
69
	fi
89
	fi
70
90
71
	new_config="reload_$(date +%FT%H:%M:%S)"
91
	new_config="reload_$(date +%FT%H:%M:%S)"
72
	$VARNISHADM vcl.load $new_config $CONFIGFILE >/dev/null 2>&1
92
	$VARNISHADM -n ${INSTANCE} vcl.load $new_config $CONFIGFILE >/dev/null 2>&1
73
	ret=$?
93
	ret=$?
74
	if [ $ret -ne 0 ]; then
94
	if [ $ret -ne 0 ]; then
75
		eerror "${SVCNAME} cannot load configuration"
95
		eerror "${SVCNAME} cannot load configuration"
76
		return 1
96
		return 1
77
	fi
97
	fi
78
	
98
	
79
	$VARNISHADM vcl.use $new_config >/dev/null 2>&1
99
	$VARNISHADM -n ${INSTANCE} vcl.use $new_config >/dev/null 2>&1
80
	ret=$?
100
	ret=$?
81
	if [ $ret -ne 0 ]; then
101
	if [ $ret -ne 0 ]; then
82
		eerror "${SVCNAME} cannot switch configuration"
102
		eerror "${SVCNAME} cannot switch configuration"

Return to bug 480252