From: Max G Date: Fri, 10 Jul 2020 19:47:47 +0000 (+0300) Subject: Check if a service is running (Fixed #1337) X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=43fe30181b104d59382e2454114a29289fdf6cf9;p=stevenblack-hosts.git Check if a service is running (Fixed #1337) --- 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]):