sshingler/capistrano-resque — pull request #52 by benweint (2013-06-24 16:36:56+00:00)
Title: Don't fail the deploy when Resque is dead - just move on

In addition to checking whether and pidfiles exist at all, this change also checks whether each PID in the pid files found exists before attempting to kill it. Without this change, a pidfile referring to a stale process will cause the entire deploy to fail, because the kill command will fail.

With this change, we check using `kill -0` first to see if the process is alive. If not, we just echo a message and remove the pidfile anyway.

This is modelled after the way sidekiq's capistrano integration handles a similar situation here:
https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/capistrano.rb#L28