From 274440f2b2974bc49d4b47e7fc3e34b020239cfb Mon Sep 17 00:00:00 2001 From: Ilia Kondrashov Date: Wed, 27 Nov 2013 18:03:06 +0400 Subject: [PATCH] make host/port configurable --- plugins/sphinx/sphinx_connections | 10 +++++++++- plugins/sphinx/sphinx_queries | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/sphinx/sphinx_connections b/plugins/sphinx/sphinx_connections index e0eb644a..da389a0a 100755 --- a/plugins/sphinx/sphinx_connections +++ b/plugins/sphinx/sphinx_connections @@ -4,8 +4,16 @@ * @author: Konstantin Kuklin * Date: 24.05.12 */ +$host = getenv('host'); +$port = getenv('port'); -$sCommandSystem = "echo 'show status;' | mysql -h127.0.0.1 -P9306 | grep connections | awk '{ print $2}';"; +if (!$host) + $host = '127.0.0.1'; + +if (!$port) + $port = 9306; + +$sCommandSystem = "echo 'show status;' | mysql -h{$host} -P{$port} | grep connections | awk '{ print $2}';"; $sTmpFilePath = "/tmp/sphinx_connections"; if (isset($argc) && $argc > 1) { diff --git a/plugins/sphinx/sphinx_queries b/plugins/sphinx/sphinx_queries index f11c5e83..0862b7c3 100755 --- a/plugins/sphinx/sphinx_queries +++ b/plugins/sphinx/sphinx_queries @@ -4,8 +4,16 @@ * @author: Konstantin Kuklin * Date: 24.05.12 */ +$host = getenv('host'); +$port = getenv('port'); -$sCommandSystem = "echo 'show status;' | mysql -h127.0.0.1 -P9306 | grep '^queries' | awk '{ print $2}';"; +if (!$host) + $host = '127.0.0.1'; + +if (!$port) + $port = 9306; + +$sCommandSystem = "echo 'show status;' | mysql -h{$host} -P{$port} | grep '^queries' | awk '{ print $2}';"; $sTmpFilePath = "/tmp/sphinx_queries"; if (isset($argc) && $argc > 1) {