Skip to content

Instantly share code, notes, and snippets.

@justin808
Last active April 10, 2017 23:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justin808/9f6edd7d647537048013 to your computer and use it in GitHub Desktop.
Save justin808/9f6edd7d647537048013 to your computer and use it in GitHub Desktop.
Script to kill errant rails development processes
export PROCESSES_TO_QUIT='bpos puma rake sidekiq spring rails$ ruby-debug phantomjs zeus passenger guard resque "node server.js" ruby$ node foreman fsevent_wat'
pgr() {
echo "Finding processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pgrep -l
}
pgk() {
echo "Killing processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -l
}
ZEUS_SOCK=/Users/justin/clients/blink/bpos/.zeus.sock
pgkk() {
echo "Killing -9 processes in list: $PROCESSES_TO_QUIT"
echo "Also removing $ZEUS_SOCK if existing"
echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -9 -l
if [[ -a ${ZEUS_SOCK} ]]; then
rm ${ZEUS_SOCK}
echo Removed ${ZEUS_SOCK}
else
echo ${ZEUS_SOCK} does not exist
fi
}
@justin808
Copy link
Author

Updated! Previously not finding "node server.js"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment