Skip to content

Instantly share code, notes, and snippets.

@loa
Created February 23, 2015 13:49
Show Gist options
  • Select an option

  • Save loa/115294d02be03838bf5c to your computer and use it in GitHub Desktop.

Select an option

Save loa/115294d02be03838bf5c to your computer and use it in GitHub Desktop.
Gitlab Sidekiq Zombie Apocalypse Crontab Sentry
#/bin/bash +xe
exec 1> >(logger -s -t $0) 2>&1
# Load RVM into a shell session *as a function*
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
num_zombies=$(ps aux | grep defunct | grep -v grep | wc -l)
[ ${num_zombies} -eq 0 ] && {
echo "Found no zombies"
} || {
echo "Found ${num_zombies} zombies, restarting sidekiq"
hipchat "Found ${num_zombies} zombies, restarting sidekiq"
RAILS_ENV=production su git -c '/home/git/gitlab/bin/background_jobs restart'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment