Gentoo Archives: gentoo-commits

From: "Anthony G. Basile (blueness)" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in www-servers/varnish/files: varnishncsa.initd-r1
Date: Fri, 03 Oct 2014 18:15:14
Message-Id: 20141003181509.6F1206DDC@oystercatcher.gentoo.org
1 blueness 14/10/03 18:15:09
2
3 Added: varnishncsa.initd-r1
4 Log:
5 Fix varnishncsa initd script, bug #524284
6
7 (Portage version: 2.2.8-r2/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)
8
9 Revision Changes Path
10 1.1 www-servers/varnish/files/varnishncsa.initd-r1
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/varnish/files/varnishncsa.initd-r1?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/varnish/files/varnishncsa.initd-r1?rev=1.1&content-type=text/plain
14
15 Index: varnishncsa.initd-r1
16 ===================================================================
17 #!/sbin/runscript
18 # Copyright 1999-2014 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20 # $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishncsa.initd-r1,v 1.1 2014/10/03 18:15:09 blueness Exp $
21
22 VARNISHNCSA_PID=${VARNISHNCSA_PID:-/run/${SVCNAME}.pid}
23
24 command="${VARNISHNCSA:-/usr/bin/varnishncsa}"
25 command_args="-D -P ${VARNISHNCSA_PID} ${VARNISHNCSA_OPTS}"
26 pidfile="${VARNISHNCSA_PID}"
27
28 extra_started_commands="reload rotate flush"
29
30 description_rotate="Rotate the log file"
31 description_flush="Flush any outstanding transactions"
32
33 # We need to make sure varnishd has started first, bug #524284
34 start_pre() {
35 TIMEOUT=${TIMEOUT:-5}
36
37 local i=0
38 while [ $i -lt ${TIMEOUT} ]; do
39 echo status | varnishadm 2>/dev/null | grep -q "Child in state running"
40 test $? -eq 0 && break
41
42 sleep 1 && i=$(expr $i + 1)
43 done
44 }
45
46 rotate() {
47 ebegin "Rotating log file"
48 start-stop-daemon -p ${VARNISHNCSA_PID} -s SIGHUP
49 eend $?
50 }
51
52 flush() {
53 ebegin "Flushing any outstanding transactions"
54 start-stop-daemon -p ${VARNISHNCSA_PID} -s SIGUSR1
55 eend $?
56 }
57
58 reload() {
59 flush
60 rotate
61 }