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: varnishd.confd-r2 varnishd.initd-r2
Date: Sat, 01 Mar 2014 19:54:02
Message-Id: 20140301195358.869DE2004C@flycatcher.gentoo.org
1 blueness 14/03/01 19:53:58
2
3 Added: varnishd.confd-r2 varnishd.initd-r2
4 Log:
5 Set logformat, bug #502972
6
7 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)
8
9 Revision Changes Path
10 1.1 www-servers/varnish/files/varnishd.confd-r2
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/varnish/files/varnishd.confd-r2?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/varnish/files/varnishd.confd-r2?rev=1.1&content-type=text/plain
14
15 Index: varnishd.confd-r2
16 ===================================================================
17 # /etc/conf.d/varnishd
18
19 VARNISHD="/usr/sbin/varnishd"
20 VARNISHADM="/usr/bin/varnishadm"
21 CONFIGFILE="/etc/varnish/default.vcl"
22
23 # Listen on 127.0.0.1:8080 and connect to backend 127.0.0.1:80
24 # Ignore the config file, /etc/varnish/default.vcl
25 VARNISHD_OPTS="-a 127.0.0.1:8080 -b 127.0.0.1:80"
26
27 # Alternatively, don't listen to a backend and use
28 # the config file
29 #VARNISHD_OPTS="-a 127.0.0.1:8080 -f $CONFIGFILE"
30
31 # Arguments passed to varnishncsa
32 # Please see varnishncsa(1) for more options
33 VARNISHNCSA_ARGS="-c -a -w /var/log/varnish/access.log"
34
35 # Arguments passed to varnishncsa -F option
36 # Please see varnishncsa(1) for more options
37 # VARNISHNCSA_LOGFORMAT='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"'
38
39 # We need to increase the number of open files (-n)
40 # and the maximum amount off locked memory (-l)
41 # See bug #459142
42 rc_ulimit="-n 32786 -l 82000"
43
44
45
46 1.1 www-servers/varnish/files/varnishd.initd-r2
47
48 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/varnish/files/varnishd.initd-r2?rev=1.1&view=markup
49 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/varnish/files/varnishd.initd-r2?rev=1.1&content-type=text/plain
50
51 Index: varnishd.initd-r2
52 ===================================================================
53 #!/sbin/runscript
54 # Copyright 1999-2014 Gentoo Foundation
55 # Distributed under the terms of the GNU General Public License v2
56 # $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishd.initd-r2,v 1.1 2014/03/01 19:53:58 blueness Exp $
57
58 extra_commands="configtest"
59 extra_started_commands="reload"
60
61 description_configtest="Run syntax tests for configuration files."
62 description_reload="Reloads the configuration."
63
64 depend() {
65 need net
66 }
67
68 configtest() {
69 ebegin "Checking ${SVCNAME} configuration"
70 checkconfig
71 eend $?
72 }
73
74 checkconfig() {
75 ${VARNISHD} -C -f ${CONFIGFILE} >/dev/null 2>&1
76 ret=$?
77 if [ $ret -ne 0 ]; then
78 eerror "${SVCNAME} has detected an error in your setup:"
79 ${VARNISHD} -C -f ${CONFIGFILE}
80 fi
81
82 return $ret
83 }
84
85 start() {
86 checkconfig || return 1
87
88 ebegin "Starting varnish"
89 start-stop-daemon --quiet --start --pidfile /run/varnishd.pid \
90 --exec ${VARNISHD} -- \
91 -P /run/varnishd.pid \
92 ${VARNISHD_OPTS} &> /dev/null
93 eend $?
94
95 if [ "${VARNISHNCSA_ARGS}" != "" ]; then
96 ebegin "Starting varnish logging"
97 start-stop-daemon --quiet --start --pidfile /run/varnishncsa.pid \
98 --exec /usr/bin/varnishncsa -- \
99 -D -P /run/varnishncsa.pid \
100 ${VARNISHNCSA_ARGS} \
101 ${VARNISHNCSA_LOGFORMAT:+-F "${VARNISHNCSA_LOGFORMAT}"}
102 eend $?
103 fi
104 }
105
106 stop() {
107 ebegin "Stopping varnish"
108 start-stop-daemon --quiet --stop --pidfile /run/varnishd.pid
109 eend $?
110
111 if [ -e /run/varnishncsa.pid ]; then
112 ebegin "Stopping varnish logging"
113 start-stop-daemon --quiet --stop --pidfile /run/varnishncsa.pid
114 eend $?
115 fi
116 }
117
118 reload() {
119 checkconfig || return 1
120
121 ebegin "Reloading varnish"
122
123 $VARNISHADM vcl.list >/dev/null 2>&1
124 ret=$?
125 if [ $ret -ne 0 ]; then
126 eerror "${SVCNAME} cannot list configuration"
127 return 1
128 fi
129
130 new_config="reload_$(date +%FT%H:%M:%S)"
131 $VARNISHADM vcl.load $new_config $CONFIGFILE >/dev/null 2>&1
132 ret=$?
133 if [ $ret -ne 0 ]; then
134 eerror "${SVCNAME} cannot load configuration"
135 return 1
136 fi
137
138 $VARNISHADM vcl.use $new_config >/dev/null 2>&1
139 ret=$?
140 if [ $ret -ne 0 ]; then
141 eerror "${SVCNAME} cannot switch configuration"
142 return 1
143 fi
144
145 eend 0
146 }