```
func gracefulShutdown() {
c := make(chan os.Signal, 1)
gosignal.Notify(c, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
go func() {
// cleanup the socket on shutdown.
sig := <-c
Close()
ret := 1
if sig == syscall.SIGTERM {
ret = 0
}
os.Exit(ret)
}()
}
```