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
1 changed files with 8 additions and 3 deletions

View File

@ -142,9 +142,14 @@ func handleStart(w http.ResponseWriter, r *http.Request) {
func childwaiter() { func childwaiter() {
err := coreDNSCommand.Wait() err := coreDNSCommand.Wait()
log.Printf("coredns terminated: %s\n", err) log.Printf("coredns unexpectedly died: %s\n", err)
err = coreDNSCommand.Process.Release() coreDNSCommand.Process.Release()
log.Printf("coredns released: %s\n", err) 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) { func handleStop(w http.ResponseWriter, r *http.Request) {