diff options
author | root <root@rshg054.dnsready.net> | 2011-12-30 23:14:51 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2011-12-30 23:14:51 +0000 |
commit | 5d738f85840804ee493d267784d9cce5dc52f535 (patch) | |
tree | 646f79576fee9f326fa833f7ca480d2355056556 /extra/varnish | |
parent | 8a823402bd45dc875237a20f174ecbe64e1bae4d (diff) |
Fri Dec 30 23:14:51 UTC 2011
Diffstat (limited to 'extra/varnish')
-rw-r--r-- | extra/varnish/PKGBUILD | 8 | ||||
-rw-r--r-- | extra/varnish/rc.varnish | 25 | ||||
-rw-r--r-- | extra/varnish/varnish.conf.d | 2 |
3 files changed, 31 insertions, 4 deletions
diff --git a/extra/varnish/PKGBUILD b/extra/varnish/PKGBUILD index 18ed8e7a4..269a1cbcf 100644 --- a/extra/varnish/PKGBUILD +++ b/extra/varnish/PKGBUILD @@ -1,4 +1,4 @@ -# $Id +# $Id: PKGBUILD 145758 2011-12-30 04:10:39Z dreisner $ # Maintainer: Dave Reisner <dreisner@archlinux.org> # Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org> # Contributor: Douglas Soares de Andrade @@ -6,7 +6,7 @@ pkgname=varnish pkgver=3.0.2 -pkgrel=2 +pkgrel=3 pkgdesc="High-performance HTTP accelerator" arch=('i686' 'x86_64') url="http://www.varnish-cache.org/" @@ -20,8 +20,8 @@ source=("http://repo.varnish-cache.org/source/$pkgname-$pkgver.tar.gz" "$pkgname.conf.d" "rc.$pkgname") md5sums=('c8eae0aabbe66b6daabdf3a1f58cd47a' - 'd42eebc7f0ac429d9740125ff1e61daf' - '18b7747020ecfe2eac7445971a7014e3') + 'edd1237d097d72173d9772754335890c' + 'fc9bf7a47479c4ad01c0e555d4e74f91') build() { cd "$srcdir/$pkgname-$pkgver" diff --git a/extra/varnish/rc.varnish b/extra/varnish/rc.varnish index 2ebd97e33..4e4fde60d 100644 --- a/extra/varnish/rc.varnish +++ b/extra/varnish/rc.varnish @@ -4,6 +4,27 @@ . /etc/rc.d/functions . /etc/conf.d/varnish +reload_vcl() { + local activecfg newcfg + + if [[ -z $VARNISH_CFG ]]; then + printf '==> ERROR: VARNISH_CFG is undefined in /etc/conf.d/varnish!\n' + return 1 + fi + + activecfg=$(varnishadm -T localhost:6082 "vcl.list" | awk '/active/{ print $3 }') + if [[ -z $activecfg ]]; then + printf '==> ERROR: No active VCL found!\n' + return 1 + fi + + printf -v newcfg 'vcl-%(%s)T' -1 + + varnishadm -T localhost:6082 "vcl.load $newcfg $VARNISH_CFG" && + varnishadm -T localhost:6082 "vcl.use $newcfg" && + varnishadm -T localhost:6082 "vcl.discard $activecfg" || return 1 +} + pidfile=/run/varnish.pid if [[ -r $pidfile ]]; then read -r PID < "$pidfile" @@ -40,6 +61,10 @@ case "$1" in sleep 1 $0 start ;; + reload) + stat_busy "Recompiling and Reloading VCL" + reload_vcl && stat_done || stat_fail + ;; *) echo "usage: $0 {start|stop|restart}" ;; diff --git a/extra/varnish/varnish.conf.d b/extra/varnish/varnish.conf.d index 2970468b7..904ca119f 100644 --- a/extra/varnish/varnish.conf.d +++ b/extra/varnish/varnish.conf.d @@ -7,3 +7,5 @@ VARNISHD_OPTS="-a 0.0.0.0:80 \ -T localhost:6082 \ -s malloc,64M -u nobody -g nobody" + +VARNISH_CFG="/etc/varnish/default.vcl" |