From 34ceffbfef2e884d6844a6267aeb7f3c6da8d0c1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:34:05 +0300 Subject: [PATCH] 1 --- hlna.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index 5ac4152..3579dfe 100755 --- a/hlna.py +++ b/hlna.py @@ -654,7 +654,7 @@ def restart(g, m): def check_exist_servers(g): - print_line("check_exist") + """Проверяет наличие конфигов для активных карт""" if g == "ark": if list_config == []: @@ -666,10 +666,8 @@ def check_exist_servers(g): def start_stop(action, g, m, list_config=list_config): - print_line("Вход в start_stop", g) """Функция изменения статусов сервера""" if g == "ark": - print_line("g_ark") check_exist_servers(g) dict_mapname = {} dict_allmapname = [] @@ -689,11 +687,16 @@ def start_stop(action, g, m, list_config=list_config): names_serverstart = choose_map(names_serverstart) for i in names_serverstart: data = read_yaml(i, game="ARK") - y = os.system( - f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" + if stop or restart: + y = os.system( + f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" + if y == 0: + print_line("Мир сохранён") x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") + if x == 0: print_line("Готово") + elif g == "7days": x = os.system(f"systemctl --user {action} 7days.service") if x == 0: