Auto start
pull/145/head
Pavel Loginov 5 years ago
parent f38560a703
commit b570be7e2b

@ -18,7 +18,7 @@ async def async_get_overview(serv1, serv2):
commands1 = [ "ps ax |grep waf/bin/modsecurity |grep -v grep |wc -l" ]
cmd = 'echo "show info" |nc %s %s |grep -e "Process_num"' % (serv2, haproxy_sock_port)
server_status = (serv1, serv2, funct.server_status(funct.subprocess_execute(cmd)), funct.ssh_command(serv2, commands), funct.ssh_command(serv2, commands1))
server_status = (serv1, serv2, funct.server_status(funct.subprocess_execute(cmd)), funct.ssh_command(serv2, commands), funct.ssh_command(serv2, commands1), sql.select_servers(server=serv2, keep_alive=1))
return server_status
async def get_runner_overview():

@ -238,6 +238,7 @@ def select_user_name_group(id):
def select_servers(**kwargs):
con, cur = create_db.get_cur()
sql = """select * from servers where enable = '1' ORDER BY groups """
if kwargs.get("server") is not None:
sql = """select * from servers where ip='%s' """ % kwargs.get("server")
if kwargs.get("full") is not None:
@ -250,6 +251,8 @@ def select_servers(**kwargs):
left join uuid as uuid on user.id = uuid.user_id
where uuid.uuid = '%s' and servers.master = 0 and servers.type_ip = 0 and servers.enable = 1 ORDER BY servers.groups
""" % kwargs.get('uuid')
if kwargs.get("server") and kwargs.get("keep_alive"):
sql = """select active from servers where ip='%s' """ % kwargs.get("server")
try:
cur.execute(sql)
except sqltool.Error as e:

@ -1,7 +1,12 @@
{% for service in service_status %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
<a href="#{{ service.0 }}" title="Go to {{ service.0 }} status" style="color: #000">{{ service.0 }}</a>
<td class="padding10">
<a href="#{{ service.0 }}" title="Go to {{ service.0 }} status" style="color: #000; padding-left: 15px;">
{{ service.0 }}
{% if service.5.0.0|int() >= 1 %}
<img src="/image/pic/shield.png" width=18 style="padding-left: 5px; margin-bottom: -3px;" title="Auto start enabled">
{% endif %}
</a>
</td>
<td class="second-collumn">
{% if service.2|int() >= 1 %}

@ -115,7 +115,7 @@
</ul>
</nav>
<div class="copyright-menu">
<a href="https://github.com/aidaho12/haproxy-wi/" title="Github repo" target="_blank" style="color: #fff">HAproxy-WI v3.4.4.5</a>
<a href="https://github.com/aidaho12/haproxy-wi/" title="Github repo" target="_blank" style="color: #fff">HAproxy-WI v3.4.4.6</a>
<br>
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
</div>

@ -32,8 +32,9 @@ def main():
except CalledProcessError as e:
alert = "Try start HAProxy serivce at " + serv[0]
funct.logging("localhost", " "+alert, keep_alive=1)
start_command = []
start_command.append(sql.get_setting('restart_command'))
start_command.append('sudo '+sql.get_setting('restart_command'))
funct.ssh_command(serv[0], start_command)
time.sleep(30)
continue

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Loading…
Cancel
Save