mirror of
https://github.com/frappe/bench.git
synced 2025-01-25 07:58:24 +00:00
fix: Allow sudo restart for supervisor (backwards compatibility)
This commit is contained in:
parent
7a4ade9192
commit
fc7c047c28
@ -253,7 +253,13 @@ def restart_supervisor_processes(bench_path=".", web_workers=False):
|
|||||||
bench.run(cmd)
|
bench.run(cmd)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path)
|
sudo = ""
|
||||||
|
try:
|
||||||
|
supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path)
|
||||||
|
except Exception as e:
|
||||||
|
if e.returncode == 127:
|
||||||
|
sudo = "sudo "
|
||||||
|
supervisor_status = get_cmd_output("sudo supervisorctl status", cwd=bench_path)
|
||||||
|
|
||||||
if web_workers and f"{bench_name}-web:" in supervisor_status:
|
if web_workers and f"{bench_name}-web:" in supervisor_status:
|
||||||
group = f"{bench_name}-web:\t"
|
group = f"{bench_name}-web:\t"
|
||||||
@ -269,7 +275,7 @@ def restart_supervisor_processes(bench_path=".", web_workers=False):
|
|||||||
else:
|
else:
|
||||||
group = "frappe:"
|
group = "frappe:"
|
||||||
|
|
||||||
bench.run(f"supervisorctl restart {group}")
|
bench.run(f"{sudo}supervisorctl restart {group}")
|
||||||
|
|
||||||
|
|
||||||
def restart_systemd_processes(bench_path=".", web_workers=False):
|
def restart_systemd_processes(bench_path=".", web_workers=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user