20 lines
303 B
Go
20 lines
303 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/signal"
|
||
|
"syscall"
|
||
|
|
||
|
"git.fuyu.moe/Fuyu/flog"
|
||
|
)
|
||
|
|
||
|
func catchSignals() {
|
||
|
sc := make(chan os.Signal, 1)
|
||
|
signal.Notify(sc, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||
|
go func() {
|
||
|
s := <-sc
|
||
|
flog.Info(`Stopping, signal: `, s)
|
||
|
os.Exit(0)
|
||
|
}()
|
||
|
}
|