From f2c451720de82f9f08b6c11d7838694cc622c536 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 17 Mar 2020 13:08:27 -0700 Subject: [PATCH] action_utils: Add utility to call systemd daemon-reload Signed-off-by: Sunil Mohan Adapa Reviewed-by: Nektarios Katakis --- plinth/action_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plinth/action_utils.py b/plinth/action_utils.py index 13842fe4a..afe7b6715 100644 --- a/plinth/action_utils.py +++ b/plinth/action_utils.py @@ -20,6 +20,12 @@ def is_systemd_running(): return os.path.exists('/run/systemd') +def service_daemon_reload(): + """Reload systemd to ensure that newer unit files are read.""" + subprocess.run(['systemctl', 'daemon-reload'], check=True, + stdout=subprocess.DEVNULL) + + def service_is_running(servicename): """Return whether a service is currently running.