Skip to content

Instantly share code, notes, and snippets.

@thalweg
Created June 13, 2011 18:55
Show Gist options
  • Save thalweg/1023436 to your computer and use it in GitHub Desktop.
Save thalweg/1023436 to your computer and use it in GitHub Desktop.
Reload varnish config
#!/usr/bin/env bash
set -eu
FILE="/etc/varnish/default.vcl"
HOST="localhost"
PORT="6082"
NOW=$(date +%s)
NC="nc ${HOST} ${PORT}"
error() {
echo 1>&2 "Failed to reload ${FILE}."
exit 1
}
echo "vcl.load reload${NOW} ${FILE}" | ${NC} || error
echo "vcl.use reload${NOW}" | ${NC} || error
echo "vcl.list" | ${NC} || error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment