Posted on 2009-02-18
One thing I do regularly is reload the default VCL that Varnish use, and to avoid using telnet or varnishadm manually, I've written a tiny script that loads and uses default.vcl (or any other file, for that matter).
#!/bin/bash # Reload a varnish config # Author: Kristian Lyngstol FILE="/etc/varnish/default.vcl" # Hostname and management port # (defined in /etc/default/varnish or on startup) HOSTPORT="localhost:6082" NOW=`date +%s` 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