1
This commit is contained in:
parent
bf623b853a
commit
e8feb51bbe
37
hlna.py
37
hlna.py
@ -796,13 +796,10 @@ def check_exist_servers(g):
|
||||
def start_stop(action, g, m):
|
||||
"""Функция изменения статусов сервера"""
|
||||
if g == "ark":
|
||||
|
||||
check_exist_servers(g)
|
||||
name_servers = choose_map(g, m)
|
||||
for i in name_servers:
|
||||
if action == "stop" or action == "restart":
|
||||
print(action)
|
||||
print_line(i, flag="CYAN")
|
||||
rcon_local(i, "SaveWorld")
|
||||
data = read_yaml(i, g="ark", flag=True)
|
||||
x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service")
|
||||
@ -874,29 +871,27 @@ def rcon(m, c):
|
||||
|
||||
|
||||
def rcon_local(m, c):
|
||||
print_line("вход в rcon", flag="CYAN")
|
||||
try:
|
||||
rcon_ports = []
|
||||
dict_mapname = {}
|
||||
dict_adminpwd = {}
|
||||
if list_config:
|
||||
rcon_ports = []
|
||||
for i in list_config:
|
||||
data = read_yaml(i, g="ark")
|
||||
dict_mapname[data['RCONPort']] = data['map']
|
||||
dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword']
|
||||
if m == "all":
|
||||
for rcon_p in dict_mapname:
|
||||
for i in list_config:
|
||||
data = read_yaml(i, g="ark")
|
||||
dict_mapname[data['RCONPort']] = data['map']
|
||||
dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword']
|
||||
if m == "all":
|
||||
for rcon_p in dict_mapname:
|
||||
rcon_ports.append(rcon_p)
|
||||
else:
|
||||
for rcon_p, name_map in dict_mapname.items():
|
||||
if name_map in m:
|
||||
rcon_ports.append(rcon_p)
|
||||
else:
|
||||
for rcon_p, name_map in dict_mapname.items():
|
||||
if name_map in m:
|
||||
rcon_ports.append(rcon_p)
|
||||
|
||||
for port in rcon_ports:
|
||||
passwd = dict_adminpwd[port]
|
||||
with Client('127.0.0.1', port, passwd=str(passwd)) as client:
|
||||
response = client.run(c)
|
||||
print_line(f"Rcon выполнен {response} {dict_mapname[port]}", flag="GREEN")
|
||||
for port in rcon_ports:
|
||||
passwd = dict_adminpwd[port]
|
||||
with Client('127.0.0.1', port, passwd=str(passwd)) as client:
|
||||
response = client.run(c)
|
||||
print_line(f"Rcon выполнен {response} {dict_mapname[port]}", flag="GREEN")
|
||||
else:
|
||||
pass
|
||||
except:
|
||||
|
Loading…
Reference in New Issue
Block a user