llmongodb/sigterm.go

23 lines
247 B
Go
Raw Permalink Normal View History

2015-11-20 15:23:12 +01:00
// sigterm
package main
import (
"os"
"os/signal"
"syscall"
)
func exit() {
done <- true
}
func setTerm() {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
exit()
}()
}