diff --git a/background.go b/background.go index a8ceb97..031d3d1 100644 --- a/background.go +++ b/background.go @@ -247,9 +247,6 @@ func (bg *Background) Run(handler Handler) { bg.start(handler) defer bg.stop() - bg.logger.Info("Send signal TSTP to stop processing new tasks") - bg.logger.Info("Send signal TERM or INT to terminate the process") - bg.waitForSignals() fmt.Println() bg.logger.Info("Starting graceful shutdown") diff --git a/signals_unix.go b/signals_unix.go index 463661f..addd595 100644 --- a/signals_unix.go +++ b/signals_unix.go @@ -16,6 +16,9 @@ import ( // SIGTERM and SIGINT will signal the process to exit. // SIGTSTP will signal the process to stop processing new tasks. func (bg *Background) waitForSignals() { + bg.logger.Info("Send signal TSTP to stop processing new tasks") + bg.logger.Info("Send signal TERM or INT to terminate the process") + sigs := make(chan os.Signal, 1) signal.Notify(sigs, unix.SIGTERM, unix.SIGINT, unix.SIGTSTP) for { diff --git a/signals_windows.go b/signals_windows.go index 513ba31..601ca2e 100644 --- a/signals_windows.go +++ b/signals_windows.go @@ -15,6 +15,7 @@ import ( // // Note: Currently SIGTSTP is not supported for windows build. func (bg *Background) waitForSignals() { + bg.logger.Info("Send signal TERM or INT to terminate the process") sigs := make(chan os.Signal, 1) signal.Notify(sigs, windows.SIGTERM, windows.SIGINT) <-sigs