From f520c5d9fde5bd6878ade1ad24775409cefca76d Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Sun, 1 Sep 2019 23:31:38 +0300 Subject: [PATCH] v3.4.4.6 Bugs --- app/ovw.py | 4 ++-- app/templates/ajax/overview.html | 2 +- update.sh | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/ovw.py b/app/ovw.py index 979d659d..974d5763 100644 --- a/app/ovw.py +++ b/app/ovw.py @@ -16,7 +16,7 @@ async def async_get_overview(serv1, serv2): haproxy_config_path = sql.get_setting('haproxy_config_path') commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ] commands1 = [ "ps ax |grep waf/bin/modsecurity |grep -v grep |wc -l" ] - commands2 = [ "ps ax |grep keep_alive.py |grep -v grep |wc -l" ] + commands2 = "ps ax |grep keep_alive.py |grep -v grep |wc -l" cmd = 'echo "show info" |nc %s %s |grep -e "Process_num"' % (serv2, haproxy_sock_port) server_status = (serv1, @@ -25,7 +25,7 @@ async def async_get_overview(serv1, serv2): funct.ssh_command(serv2, commands), funct.ssh_command(serv2, commands1), sql.select_servers(server=serv2, keep_alive=1), - funct.ssh_command(serv2, commands2)) + funct.subprocess_execute(commands2)) return server_status async def get_runner_overview(): diff --git a/app/templates/ajax/overview.html b/app/templates/ajax/overview.html index 599dba99..9d03f642 100644 --- a/app/templates/ajax/overview.html +++ b/app/templates/ajax/overview.html @@ -6,7 +6,7 @@ {% if service.5.0.0|int() >= 1 %} = 1 %} + {% if service.6.0.0|int() >= 1 %} src="/image/pic/shield.png" title="Auto start enabled" {% else %} src="/image/pic/shield-red.png" title="Auto start enabled, but keep alive service does not work" diff --git a/update.sh b/update.sh index c7013749..7f6d20ad 100644 --- a/update.sh +++ b/update.sh @@ -28,8 +28,8 @@ After=syslog.target network.target [Service] Type=simple -WorkingDirectory=/var/www/$HOME_HAPROXY_WI/app/ -ExecStart=/var/www/$HOME_HAPROXY_WI/app/tools/keep_alive.py +WorkingDirectory=$(pwd)/app/ +ExecStart=$(pwd)/app/tools/keep_alive.py StandardOutput=syslog StandardError=syslog @@ -44,13 +44,13 @@ WantedBy=multi-user.target EOF cat << 'EOF' > /etc/rsyslog.d/keep_alive.conf -if $programname startswith 'keep_alive' then /var/www/__HOME_HAPROXY_WI__/log/keep_alive.log +if $programname startswith 'keep_alive' then $(pwd)/log/keep_alive.log & stop EOF -sed -i -e "s/__HOME_HAPROXY_WI__/$HOME_HAPROXY_WI/g" /etc/rsyslog.d/keep_alive.conf + cat << EOF > /etc/logrotate.d/metrics -/var/www/$HOME_HAPROXY_WI/log/keep_alive.log { +$(pwd)/log/keep_alive.log { daily rotate 10 missingok