Skip to content

Instantly share code, notes, and snippets.

@digitalm
Created October 2, 2018 06:51
Show Gist options
  • Save digitalm/8c32953cd0f075a967c8ef5f3752f530 to your computer and use it in GitHub Desktop.
Save digitalm/8c32953cd0f075a967c8ef5f3752f530 to your computer and use it in GitHub Desktop.
stopping ステータスになった sidekiq を殺す
#!/bin/sh
# exec by cron
# * * * * * /home/app/cron/sidekiq-killer.sh >> /var/log/cronlog/cron.log 2>&1
# if use pid, get sidekiq-0.pid
# PID=`cat /var/www/app/shared/tmp/pids/sidekiq-0.pid`
count=`ps aux | grep -v grep | grep sidekiq | grep 'busy] stopping' | wc -l`
pid=`ps aux | grep -v grep | grep sidekiq | grep 'busy] stopping' | awk '{print $2}'`
if [ $count = 1 ]; then
echo Killing stopping sidekiq, pid is $pid
kill -TERM $pid
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment