aboutsummaryrefslogtreecommitdiffstats
path: root/config/zabbix-proxy-lts
diff options
context:
space:
mode:
authorDanilo G. Baio (dbaio) <dbaio@bsd.com.br>2015-05-15 16:00:16 -0300
committerDanilo G. Baio (dbaio) <dbaio@bsd.com.br>2015-05-15 16:00:16 -0300
commitf9326e8846142610efd6e3e617685834e607e405 (patch)
treec9996c60b28ce4798d5c981ad567863628586c0d /config/zabbix-proxy-lts
parent0649759c5ec61130ee1605834cd5f3a7ec24e3d9 (diff)
downloadpfsense-packages-f9326e8846142610efd6e3e617685834e607e405.tar.gz
pfsense-packages-f9326e8846142610efd6e3e617685834e607e405.tar.bz2
pfsense-packages-f9326e8846142610efd6e3e617685834e607e405.zip
zabbix_proxy_lts - check if zabbix_proxy is still running after execution of killall command
Diffstat (limited to 'config/zabbix-proxy-lts')
-rw-r--r--config/zabbix-proxy-lts/zabbix-proxy-lts.inc59
1 files changed, 34 insertions, 25 deletions
diff --git a/config/zabbix-proxy-lts/zabbix-proxy-lts.inc b/config/zabbix-proxy-lts/zabbix-proxy-lts.inc
index 3fc71a84..bc9864f4 100644
--- a/config/zabbix-proxy-lts/zabbix-proxy-lts.inc
+++ b/config/zabbix-proxy-lts/zabbix-proxy-lts.inc
@@ -174,38 +174,47 @@ EOF;
exec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/zabbix22");
$dir_checks = <<< EOF
-if [ ! -d /var/log/zabbix-proxy-lts ]
- then
- /bin/mkdir -p /var/log/zabbix-proxy-lts
- /usr/sbin/chmod 755 /var/log/zabbix-proxy-lts
- fi
-/usr/sbin/chown -R zabbix:zabbix /var/log/zabbix-proxy-lts
-
-if [ ! -d /var/run/zabbix-proxy-lts ]
- then
- /bin/mkdir -p /var/run/zabbix-proxy-lts
- /usr/sbin/chmod 755 /var/run/zabbix-proxy-lts
- fi
-/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix-proxy-lts
-
-if [ ! -d /var/db/zabbix-proxy-lts ]
- then
- /bin/mkdir -p /var/db/zabbix-proxy-lts
- /usr/sbin/chmod 755 /var/db/zabbix-proxy-lts
- fi
-/usr/sbin/chown -R zabbix:zabbix /var/db/zabbix-proxy-lts
+
+ if [ ! -d /var/log/zabbix-proxy-lts ]; then
+ /bin/mkdir -p /var/log/zabbix-proxy-lts
+ /usr/sbin/chmod 755 /var/log/zabbix-proxy-lts
+ fi
+ /usr/sbin/chown -R zabbix:zabbix /var/log/zabbix-proxy-lts
+
+ if [ ! -d /var/run/zabbix-proxy-lts ]; then
+ /bin/mkdir -p /var/run/zabbix-proxy-lts
+ /usr/sbin/chmod 755 /var/run/zabbix-proxy-lts
+ fi
+ /usr/sbin/chown -R zabbix:zabbix /var/run/zabbix-proxy-lts
+
+ if [ ! -d /var/db/zabbix-proxy-lts ]; then
+ /bin/mkdir -p /var/db/zabbix-proxy-lts
+ /usr/sbin/chmod 755 /var/db/zabbix-proxy-lts
+ fi
+ /usr/sbin/chown -R zabbix:zabbix /var/db/zabbix-proxy-lts
+
+EOF;
+
+ $pid_check = <<< EOF
+
+ /bin/pgrep -anx zabbix_proxy 2>/dev/null
+ if [ "\$?" -eq "0" ]; then
+ /usr/bin/killall -9 zabbix_proxy
+ /bin/rm -f /var/run/zabbix-proxy-lts/zabbix_proxy_lts.pid
+ fi
EOF;
$zproxy_rcfile="/usr/local/etc/rc.d/zabbix_proxy_lts.sh";
if (is_array($zbproxy_config) && $zbproxy_config['proxyenabled']=="on"){
- $zproxy_start= strtr($dir_checks, array("\r" => "")). "\necho \"Starting Zabbix Proxy LTS\"...\n";
- /* start zabbix proxy */
- $zproxy_start .= ZABBIX_PROXY_BASE . "/sbin/zabbix_proxy\n";
+ $zproxy_start = strtr($dir_checks, array("\r" => ""));
+ $zproxy_start .= "\techo \"Starting Zabbix Proxy LTS\"...\n";
+ $zproxy_start .= "\t" . ZABBIX_PROXY_BASE . "/sbin/zabbix_proxy\n";
$zproxy_stop = "echo \"Stopping Zabbix Proxy LTS\"\n";
- $zproxy_stop .= "/usr/bin/killall zabbix_proxy\n";
- $zproxy_stop .= "/bin/sleep 5\n";
+ $zproxy_stop .= "\t/usr/bin/killall zabbix_proxy\n";
+ $zproxy_stop .= "\t/bin/sleep 5\n";
+ $zproxy_stop .= strtr($pid_check, array("\r" => ""));
/* write out rc.d start/stop file */
write_rcfile(array(