From f78a59ea47984775f69368f59d88012e521f3653 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 27 Apr 2010 21:21:51 -0400 Subject: Eliminate a case where a LB Director and a Backend may have the same name by appending BACKEND to the end of all backend names --- config/varnish64/varnish.inc | 39 ++++++++++++++++++++++++------- config/varnish64/varnish_backends.xml | 5 ++++ config/varnish64/varnish_custom_vcl.xml | 1 + config/varnish64/varnish_lb_directors.xml | 2 ++ config/varnish64/varnish_settings.xml | 1 + 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc index e098e20a..7535b1bb 100644 --- a/config/varnish64/varnish.inc +++ b/config/varnish64/varnish.inc @@ -31,6 +31,18 @@ */ /* ========================================================================== */ +function varnish_install() { + create_varnish_rcd_file(); +} + +function varnish_deinstall() { + create_varnish_rcd_file(); +} + +function varnish_start() { + mwexec("/usr/local/etc/rc.d/varnish.sh"); +} + /* Return true if a backend is in use */ function is_varnish_backend_in_use($backendname) { global $g, $config; @@ -75,7 +87,7 @@ EOAU; $urlmappings .= "else "; $urlmappings .= <</dev/null killall varnishd 2>/dev/null sleep 1 +/usr/bin/env \ +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ +/usr/local/bin/php -q -d auto_prepend_file=config.inc < +ENDOFF /usr/local/sbin/varnishd \ {$listeningport} \ -f /var/etc/default.vcl \ @@ -133,6 +155,7 @@ EOF; function get_backend_config_txt() { global $config, $g; + $backends_used = array(); if($config['installedpackages']['varnishbackends']['config'] != "") { foreach($config['installedpackages']['varnishbackends']['config'] as $backend) { if($backend['connect_timeout']) @@ -168,8 +191,9 @@ function get_backend_config_txt() { else $probe_threshold = "5"; if(is_varnish_backend_in_use($backend['backendname'])) - $backends .= << + + varnish_install(); + sync_package_varnish(); + varnish_start(); sync_package_varnish(); + varnish_start(); \ No newline at end of file diff --git a/config/varnish64/varnish_custom_vcl.xml b/config/varnish64/varnish_custom_vcl.xml index 7b35426a..0794d825 100644 --- a/config/varnish64/varnish_custom_vcl.xml +++ b/config/varnish64/varnish_custom_vcl.xml @@ -126,5 +126,6 @@ sync_package_varnish(); + varnish_start(); \ No newline at end of file diff --git a/config/varnish64/varnish_lb_directors.xml b/config/varnish64/varnish_lb_directors.xml index a622ad46..4d41687c 100644 --- a/config/varnish64/varnish_lb_directors.xml +++ b/config/varnish64/varnish_lb_directors.xml @@ -151,8 +151,10 @@ sync_package_varnish(); + varnish_start(); sync_package_varnish(); + varnish_start(); \ No newline at end of file diff --git a/config/varnish64/varnish_settings.xml b/config/varnish64/varnish_settings.xml index 988fe0db..82f1fa18 100644 --- a/config/varnish64/varnish_settings.xml +++ b/config/varnish64/varnish_settings.xml @@ -118,5 +118,6 @@ sync_package_varnish(); + varnish_start(); \ No newline at end of file -- cgit v1.2.3