Example #1
0
func handleSignal(app *tunnel.App) {
	c := make(chan os.Signal, 1)
	signal.Notify(c, SIG_STOP, SIG_RELOAD, SIG_STATUS, syscall.SIGTERM, syscall.SIGHUP)

	for sig := range c {
		switch sig {
		case SIG_STOP:
			app.Stop()
		case SIG_RELOAD:
			app.Reload()
		case SIG_STATUS:
			app.Status()
		default:
			tunnel.Log("catch signal:%v, ignore", sig)
		}
	}
}
Example #2
0
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")
		}
	}
}