Check if a service is running (Fixed #1337)
authorMax G <redacted>
Fri, 10 Jul 2020 19:47:47 +0000 (22:47 +0300)
committerMax G <redacted>
Fri, 10 Jul 2020 19:47:47 +0000 (22:47 +0300)
updateHostsFile.py

index 8eaff17177ca46059c0e066e5a82b8ac9c640124..a2f09ebd90ac79705977bb132e3dd1b3d5743f06 100644 (file)
@@ -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]):
git clone https://git.99rst.org/PROJECT