agnhost: fix sigterm shutdown

This commit is contained in:
Antonio Ojea 2022-05-25 12:15:07 +02:00
parent d5579bf778
commit 2b822161f0
2 changed files with 7 additions and 7 deletions

View File

@ -1 +1 @@
2.38
2.39

View File

@ -175,14 +175,14 @@ func main(cmd *cobra.Command, args []string) {
close(sigTermReceived)
}()
if delayShutdown > 0 {
go func() {
<-sigTermReceived
go func() {
<-sigTermReceived
if delayShutdown > 0 {
log.Printf("Sleeping %d seconds before terminating...", delayShutdown)
time.Sleep(time.Duration(delayShutdown) * time.Second)
os.Exit(0)
}()
}
}
os.Exit(0)
}()
if httpOverride != "" {
mux := http.NewServeMux()