From 43fe30181b104d59382e2454114a29289fdf6cf9 Mon Sep 17 00:00:00 2001 From: Max G Date: Fri, 10 Jul 2020 22:47:47 +0300 Subject: [PATCH] Check if a service is running (Fixed #1337) --- updateHostsFile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/updateHostsFile.py b/updateHostsFile.py index 8eaff1717..a2f09ebd9 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -1306,6 +1306,9 @@ def flush_dns_cache(): ) if os.path.isfile(service_file): + if 0 != subprocess.call([systemctl, "status", service], + stdout=subprocess.DEVNULL): + continue dns_cache_found = True if subprocess.call(SUDO + [systemctl, "restart", service]):