diff --git a/docs/Webhook-Parameters.md b/docs/Webhook-Parameters.md index 7699357..bd6fcb4 100644 --- a/docs/Webhook-Parameters.md +++ b/docs/Webhook-Parameters.md @@ -44,7 +44,9 @@ Usage of webhook: Use any of the above specified flags to override their default behavior. # Live reloading hooks -If you are running an OS that supports USR1 signal, you can use it to trigger hooks reload from hooks file, without restarting the webhook instance. +If you are running an OS that supports the HUP or USR1 signal, you can use it to trigger hooks reload from hooks file, without restarting the webhook instance. ```bash kill -USR1 webhookpid + +kill -HUP webhookpid ``` diff --git a/signals.go b/signals.go index d53a3f6..30dacf8 100644 --- a/signals.go +++ b/signals.go @@ -14,6 +14,7 @@ func setupSignals() { signals = make(chan os.Signal, 1) signal.Notify(signals, syscall.SIGUSR1) + signal.Notify(signals, syscall.SIGHUP) go watchForSignals() } @@ -23,11 +24,16 @@ func watchForSignals() { for { sig := <-signals - if sig == syscall.SIGUSR1 { + switch sig { + case syscall.SIGUSR1: log.Println("caught USR1 signal") reloadAllHooks() - } else { + case syscall.SIGHUP: + log.Println("caught HUP signal") + + reloadAllHooks() + default: log.Printf("caught unhandled signal %+v\n", sig) } }