func handleSignal(app *tunnel.App) { c := make(chan os.Signal, 1) signal.Notify(c, SIG_STATUS, syscall.SIGTERM, syscall.SIGHUP) for sig := range c { switch sig { case SIG_STATUS: app.Status() default: tunnel.Log("catch signal:%v, ignore", sig) } } }
func handleSignal(app *tunnel.App) { c := make(chan os.Signal, 1) signal.Notify(c, SIG_STOP, SIG_RELOAD, SIG_STATUS, syscall.SIGTERM) for sig := range c { switch sig { case SIG_STOP: app.Stop() case SIG_RELOAD: app.Reload() case SIG_STATUS: fmt.Println("catch sigstatus, ignore") case syscall.SIGTERM: fmt.Println("catch sigterm, ignore") } } }