fixy
This commit is contained in:
10
app.py
10
app.py
@@ -74,15 +74,15 @@ def serviceCommand(name: str):
|
|||||||
return f"systemctl reload {name}"
|
return f"systemctl reload {name}"
|
||||||
|
|
||||||
def runCmd(cmd: str):
|
def runCmd(cmd: str):
|
||||||
"""Uruchamia komendę w shellu z timeoutem i logowaniem."""
|
|
||||||
logger.info(f"Exec: {cmd}")
|
logger.info(f"Exec: {cmd}")
|
||||||
try:
|
try:
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["PATH"] = getCfg("exec_path", DEFAULT_EXEC_PATH) or DEFAULT_EXEC_PATH
|
||||||
out = subprocess.run(
|
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()
|
return out.returncode, (out.stdout or "").strip(), (out.stderr or "").strip()
|
||||||
stderr = (out.stderr or "").strip()
|
|
||||||
return out.returncode, stdout, stderr
|
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
return 124, "", "Timeout"
|
return 124, "", "Timeout"
|
||||||
|
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
[daemon]
|
[daemon]
|
||||||
API_TOKEN = apitoken
|
API_TOKEN = apitoken
|
||||||
|
|
||||||
|
backup_path= /backup
|
||||||
|
|
||||||
services = dnsmasq
|
services = dnsmasq
|
||||||
|
|
||||||
# opcjonalnie: globalny timeout (sekundy)
|
# opcjonalnie: globalny timeout (sekundy)
|
||||||
|
Reference in New Issue
Block a user