diff options
author | root <root@rshg054.dnsready.net> | 2012-08-16 00:02:36 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-08-16 00:02:36 +0000 |
commit | 0fc1870f2eadde8cb06004be1cbe8d1a4333aa69 (patch) | |
tree | 09ae142c72b3ef3bba14bcd0fbd982446585d894 /extra/varnish/varnish-vcl-reload | |
parent | 8f1eb849d6de0031d4d91fb6d8780828b1ba924b (diff) |
Thu Aug 16 00:02:36 UTC 2012
Diffstat (limited to 'extra/varnish/varnish-vcl-reload')
-rw-r--r-- | extra/varnish/varnish-vcl-reload | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/extra/varnish/varnish-vcl-reload b/extra/varnish/varnish-vcl-reload new file mode 100644 index 000000000..aaac385c4 --- /dev/null +++ b/extra/varnish/varnish-vcl-reload @@ -0,0 +1,21 @@ +#!/bin/sh + +cfg=${1:-/etc/varnish/default.vcl} + +if [ ! -e "$cfg" ]; then + printf 'ERROR: VCL file %s does not exist\n' "$cfg" >&2 + exit 1 +fi + +activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }') +if [ -z "$activecfg" ]; then + printf 'ERROR: No active VCL found!\n' >&2 + exit 1 +fi + +newcfg=$(date +'vcl-%s') +printf 'INFO: using new config %s\n' "$cfg" + +varnishadm "vcl.load $newcfg $cfg" && +varnishadm "vcl.use $newcfg" && +varnishadm "vcl.discard $activecfg" |