Skip to content

Instantly share code, notes, and snippets.

View antoniosb's full-sized avatar

Antônio Augusto antoniosb

View GitHub Profile
@Cryptophobia
Cryptophobia / kube-resque-pre-stop.sh
Last active November 9, 2018 22:34
preStop Kubernetes Lifecycle Resque Hook
#!/bin/bash
# This script gracefully stops resque workers by issuing the USR2
# signal to the resque-pool manager and then waits for the workers
# to be paused before exiting. Resque-pool master process relays
# the USR2 signal to the children.
#
# For reference:
# (1) https://github.com/nevans/resque-pool#signals
# (2) https://github.com/resque/resque/blob/master/lib/resque/worker.rb#L376-L378