From: Steven Black Date: Thu, 24 Mar 2016 22:07:17 +0000 (-0400) Subject: Issue #117 — fix: restart network.service if applicable. X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=97ef0fdded7c124b6f9e84803d8a08a190c1425f;p=stevenblack-hosts.git Issue #117 — fix: restart network.service if applicable. --- diff --git a/updateHostsFile.py b/updateHostsFile.py index d391b970d..dfd4703ff 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -457,6 +457,12 @@ def moveHostsFileIntoPlace(finalFile): printFailure("Flushing the DNS Cache failed.") else: printSuccess("Flushing DNS by restarting dnsmasq succeeded") + if os.path.isfile("/usr/lib/systemd/system/networking.service"): + dnsCacheFound = True + if subprocess.call(["/usr/bin/sudo", "/usr/bin/systemctl", "restart", "networking.service"]): + printFailure("Flushing the DNS Cache failed.") + else: + printSuccess("Flushing DNS by restarting networking.service succeeded") if not dnsCacheFound: printFailure("Unable to determine DNS management tool.") elif os.name == 'nt':