if coredns unexpectedly quits, restart it

This commit is contained in:
Eugene Bujak 2018-10-07 00:59:21 +03:00
parent 2244c21b76
commit 656d092ad6

View file

@ -142,9 +142,14 @@ func handleStart(w http.ResponseWriter, r *http.Request) {
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns terminated: %s\n", err)
err = coreDNSCommand.Process.Release()
log.Printf("coredns released: %s\n", err)
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns\n", err)
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {