Skip to content

Instantly share code, notes, and snippets.

@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