Skip to content

Instantly share code, notes, and snippets.

@cheald
Created November 3, 2012 00:41
Show Gist options
  • Save cheald/4005272 to your computer and use it in GitHub Desktop.
Save cheald/4005272 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Reload a varnish config
# Author: Kristian Lyngstol
FILE="/etc/varnish/yourconfig.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment