aboutsummaryrefslogtreecommitdiffstats
path: root/main/varnish/varnishd.initd
blob: a10e219a8e5a4d467abcf4509820dd4762f9929b (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
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishd.initd,v 1.7 2009/08/30 06:28:07 hollow Exp $

extra_commands=reload

depend() {
	need net
}

start() {
	ebegin "Starting varnish"
	#allow varnishd to lock logfile to memory
	ulimit -l 82000
	start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec /usr/sbin/varnishd -- -P /var/run/varnishd.pid ${VARNISHD_OPTS} &> /dev/null
	eend $?

	if [ "${VARNISHNCSA_ARGS}" != "" ]; then
		ebegin "Starting varnish logging"
		start-stop-daemon --quiet --start --pidfile /var/run/varnishncsa.pid --exec /usr/bin/varnishncsa -- -D -P /var/run/varnishncsa.pid ${VARNISHNCSA_ARGS}
		eend $?
	fi
}

stop() {
	ebegin "Stopping varnish"
	start-stop-daemon --quiet --stop --pidfile /var/run/varnishd.pid
	eend $?

	if [ -e /var/run/varnishncsa.pid ]; then
		ebegin "Stopping varnish logging"
		start-stop-daemon --quiet --stop --pidfile /var/run/varnishncsa.pid
		eend $?
	fi
}

reload() {
        ebegin "Reloading varnish"
	NOW=`date +%s`
        /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.load reload$NOW $CFG_FILE
        /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.use reload$NOW $CFG_FILE
        eend $?
}