PID=`cat ~/resque.pid`

# Check if the process id is in the running processes list
count=`ps x --no-header -eo pid | grep -c $PID`

if [ "$count" -eq "1" ]; then
    cat ~/resque.pid | xargs kill
fi
/bin/sh -c 'kill -9 `cat /home/deploy/resque.pid` && rm -f cat /home/deploy/resque.pid; exit 0;'

Kill the Resque worker with the defined PID
Kill the Resque worker with the defined PID
