Fixed ubuntu hosts file relaod
authorZaur Molotnikov <redacted>
Fri, 30 Oct 2015 10:18:08 +0000 (11:18 +0100)
committerZaur Molotnikov <redacted>
Fri, 30 Oct 2015 10:18:08 +0000 (11:18 +0100)
updateHostsFile.py

index a78825ddb9b979d03de5da07e23d8ba510be15ad..90de9d1cdaee3a2162d6310d3d841fdd75365cfe 100755 (executable)
@@ -294,8 +294,9 @@ def moveHostsFileIntoPlace(finalFile):
                        if(subprocess.call(["/usr/bin/sudo", "killall", "-HUP", "mDNSResponder"])):
                                printFailure("Flushing the DNS Cache failed.")
                else:
-                       if(subprocess.call(["/usr/bin/sudo", "/etc/rc.d/init.d/nscd", "restart"])):
-                               printFailure("Flushing the DNS Cache failed.")
+                       if os.path.isfile("/etc/rc.d/init.d/nscd"):
+                               if(subprocess.call(["/usr/bin/sudo", "/etc/rc.d/init.d/nscd", "restart"])):
+                                       printFailure("Flushing the DNS Cache failed.")
        elif (os.name == 'nt'):
                print ('Automatically moving the hosts file in place is not yet supported.')
                print ('Please move the generated file to %SystemRoot%\system32\drivers\etc\hosts')
git clone https://git.99rst.org/PROJECT