From 538ad7df148e8b265a8c2db42db6492b55abe463 Mon Sep 17 00:00:00 2001 From: George Nikishin <58753684+blackmou5e@users.noreply.github.com> Date: Sat, 16 Dec 2023 02:16:27 +0300 Subject: [PATCH] added SIGQUIT handling (#144) * added SIGQUIT handling * updated readme --- README.md | 3 ++- main.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aeb0d03..39fcc48 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ implementations are ill-suited for container environments: email this output or simply discard it. In a containerized environment, logging task output and errors to `stdout` / `stderr` is often easier to work with. -- They often don't respond gracefully to `SIGINT` / `SIGTERM`, and may leave +- They often don't respond gracefully to `SIGINT` / `SIGTERM` / `SIGQUIT`, and may leave running jobs orphaned when signaled. Again, this makes sense in a server environment where `init` will handle the orphan jobs and Cron isn't restarted often anyway, but it's inappropriate in a container environment as it'll @@ -43,6 +43,7 @@ a container to behave: deliver via CTRL+C when used interactively) - Job return codes and schedules are logged to `stdout` / `stderr` - `SIGUSR2` triggers a graceful shutdown and reloads the crontab configuration +- `SIGQUIT` triggers a graceful shutdown ## How does it work? ## diff --git a/main.go b/main.go index e345619..9a09d2d 100644 --- a/main.go +++ b/main.go @@ -175,7 +175,7 @@ func main() { } termChan := make(chan os.Signal, 1) - signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGUSR2) + signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGUSR2) termSig := <-termChan