diff options
-rw-r--r-- | main.go | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -42,9 +42,14 @@ func main() { go server.Start() defer server.Stop() + await(syscall.SIGTERM, syscall.SIGINT) +} + +func await(signals ...syscall.Signal) { listener := make(chan os.Signal) - signal.Notify(listener, syscall.SIGTERM) - signal.Notify(listener, syscall.SIGINT) + for _, s := range signals { + signal.Notify(listener, s) + } sig := <-listener - log.Printf("Cleaning up due to OS signal '%v'\n", sig) + log.Printf("Received OS signal '%v'\n", sig) } |