Created
June 18, 2020 14:37
-
-
Save mrsoftware/5d5bda06cbef05f91cfe259a352f2348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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