Restart monitor_rascsi from the Web UI (#341)

This commit is contained in:
Daniel Markstedt 2021-10-19 17:58:30 -07:00 committed by GitHub
parent 1cae11bcac
commit 8ab16a1fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -1,10 +1,10 @@
import subprocess
def rascsi_service(action):
def systemd_service(service, action):
# start/stop/restart
return (
subprocess.run(["sudo", "/bin/systemctl", action, "rascsi.service"]).returncode
subprocess.run(["sudo", "/bin/systemctl", action, service]).returncode
== 0
)

View File

@ -29,8 +29,8 @@ from pi_cmds import (
shutdown_pi,
reboot_pi,
running_env,
systemd_service,
running_netatalk,
rascsi_service,
is_bridge_setup,
disk_space,
)
@ -473,7 +473,8 @@ def rascsi_restart():
detach_all()
flash("Safely detached all devices.")
flash("Restarting RaSCSI Service...")
rascsi_service("restart")
systemd_service("rascsi.service", "restart")
systemd_service("monitor_rascsi.service", "restart")
return redirect(url_for("index"))