Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added SIGQUIT handling #144

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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? ##

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading