blob: aaac385c4ce4f3a04918a9752bc90cce2e3d3008 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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"
|