Skip to content

Instantly share code, notes, and snippets.

@mrsoftware
Created June 18, 2020 14:37
Show Gist options
  • Save mrsoftware/5d5bda06cbef05f91cfe259a352f2348 to your computer and use it in GitHub Desktop.
Save mrsoftware/5d5bda06cbef05f91cfe259a352f2348 to your computer and use it in GitHub Desktop.
package main
import (
"os"
"os/signal"
"syscall"
)
func main() {
Start()
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGHUP)
for sig := range c {
switch sig {
case syscall.SIGINT:
Stop()
return
case syscall.SIGHUP:
Stop()
Start()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment