Skip to content

Commit

Permalink
added SIGQUIT handling (#144)
Browse files Browse the repository at this point in the history
* added SIGQUIT handling

* updated readme
  • Loading branch information
blackmou5e authored Dec 15, 2023
1 parent 7a88e8d commit 538ad7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit 538ad7d

Please sign in to comment.