Skip to content

Instantly share code, notes, and snippets.

@wearethefoos
Last active December 27, 2015 18:39
Show Gist options
  • Save wearethefoos/7371095 to your computer and use it in GitHub Desktop.
Save wearethefoos/7371095 to your computer and use it in GitHub Desktop.
Check with bash whether your Resque workers run from the current release folder.
releases=`ps aux | grep resque- | sudo pwdx \`awk '{print $2}'\` | sed 's/\(.*\)\/path\/to\/releases\/\(.*\)/\2/' | sed 's/.*No such process//'`
current_release=`readlink /path/to/current | sed 's/\/path\/to\/releases\/\(.*\)/\1/'`
for r in $releases; do
if [ $r = $current_release ]; then
echo 'yes'
else
echo 'no'
fi
done
for r in `ps aux | grep resque- | sudo pwdx \`awk '{print $2}'\` | sed 's/\(.*\)\/path\/to\/releases\/\(.*\)/\2/' | sed 's/.*No such process//'`; do if [ `readlink /path/to/current | sed 's/\/path\/to\/releases\/\(.*\)/\1/'` = $r ]; then echo 'yes'; else echo 'no'; fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment