Centos/RHEL init script - reload/configtest
anand at rediff-inc.com
anand at rediff-inc.com
Fri Oct 15 09:19:16 CEST 2010
Hi Guys,
A sample script I use to reload varnish configs; maybe useful to you....
#!/bin/bash
# Reload a varnish config
FILE="/etc/varnish/varnish.vcl"
# Hostname and management port
# (defined in /etc/default/varnish or on startup)
HOSTPORT="IPADDRESS:PORT"
NOW=`date +%d%h%Y`
error()
{
echo 1>&2 "Failed to reload $FILE."
exit 1
}
varnishadm -T $HOSTPORT vcl.load reload$NOW $FILE || error
varnishadm -T $HOSTPORT vcl.use reload$NOW || error
echo Current configs:
varnishadm -T $HOSTPORT vcl.list
Regards,
Anand
-----Original Message-----
From: varnish-misc-bounces at varnish-cache.org
[mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Ross Brown
Sent: Friday, October 15, 2010 2:36 AM
To: Simon Lyall; varnish-misc at varnish-cache.org
Subject: RE: Centos/RHEL init script - reload/configtest
It's easy enough to load a new config on the fly (without losing the
contents of the cache) using the Varnish CLI.
http://www.varnish-cache.org/trac/wiki/CLI
I actually use a small shell script to call varnishadm against our Varnish
servers.
It's easier than logging on to each one individually and doing 'vcl.load
test-conf.vcl' followed by 'vcl.use test-conf.vcl'
Cheers
Ross
-----Original Message-----
From: varnish-misc-bounces at varnish-cache.org
[mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Simon Lyall
Sent: Thursday, 14 October 2010 3:41 p.m.
To: varnish-misc at varnish-cache.org
Subject: Centos/RHEL init script - reload/configtest
I'm using the RHEL/Centos packages ( varnish-2.1.3 SVN 5049:5055 ) and I
notice that the init.d script doesn't have a way to reload a new config
without restarting the daemon (and losing the current cache).
Looking around I came across the following version:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/varnish/varnish.init?re
v=1.20;content-type=text%2Fplain
which appears to impliment config checking and reloading of new configs.
Looks like it would be easy enough to adapt.
Just wondering if anyone else has already done this and if so could they
share (and perhaps if the official packages could include)?
Assuming this is actually a good idea of course.
--
Simon Lyall | Very Busy | Web: http://www.darkmere.gen.nz/ "To stay
awake all night adds a day to your life" - Stilgar | eMT.
_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
More information about the varnish-misc
mailing list