Skip to content

Instantly share code, notes, and snippets.

@smerrill
Created December 8, 2010 18:50
Show Gist options
  • Save smerrill/733708 to your computer and use it in GitHub Desktop.
Save smerrill/733708 to your computer and use it in GitHub Desktop.
Load a new VCL file, replace the running configuration, and set all cache to be purged.
OLD_CFG=`varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 "vcl.list" | grep active | awk '{print $3}'`
NEW_CFG="vcl-"`date +%s`
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 "vcl.load $NEW_CFG /etc/varnish/default.vcl"
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 "vcl.use $NEW_CFG"
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 "vcl.discard $OLD_CFG"
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 "purge req.url ~ .*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment