From 3947e590d6b378b2fe07aae93d56bfc0b3b1cb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Fri, 5 Sep 2025 09:45:42 +0200 Subject: [PATCH] fixy --- app.py | 10 +++++----- config.example.ini | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index c1558dd..715bd2d 100644 --- a/app.py +++ b/app.py @@ -74,15 +74,15 @@ def serviceCommand(name: str): return f"systemctl reload {name}" def runCmd(cmd: str): - """Uruchamia komendÄ™ w shellu z timeoutem i logowaniem.""" logger.info(f"Exec: {cmd}") try: + env = os.environ.copy() + env["PATH"] = getCfg("exec_path", DEFAULT_EXEC_PATH) or DEFAULT_EXEC_PATH out = subprocess.run( - cmd, shell=True, capture_output=True, text=True, timeout=RELOAD_TIMEOUT + cmd, shell=True, capture_output=True, text=True, + timeout=RELOAD_TIMEOUT, env=env ) - stdout = (out.stdout or "").strip() - stderr = (out.stderr or "").strip() - return out.returncode, stdout, stderr + return out.returncode, (out.stdout or "").strip(), (out.stderr or "").strip() except subprocess.TimeoutExpired: return 124, "", "Timeout" diff --git a/config.example.ini b/config.example.ini index 4acb47d..51ca475 100644 --- a/config.example.ini +++ b/config.example.ini @@ -1,6 +1,8 @@ [daemon] API_TOKEN = apitoken +backup_path= /backup + services = dnsmasq # opcjonalnie: globalny timeout (sekundy)