Skip to content

Instantly share code, notes, and snippets.

@eddroid
Last active August 12, 2016 04:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eddroid/66980336dad2609341f28b8bbd632fa5 to your computer and use it in GitHub Desktop.
Save eddroid/66980336dad2609341f28b8bbd632fa5 to your computer and use it in GitHub Desktop.
Puma Hunter

Puma Hunter

Hunts down and kills loose Puma Rails server processes.

Build

You only need to run this once.

# Terminal
mkdir ~/bin
if [ ! -e ~/bin/puma_hunter.sh ]; then
  echo "#! /bin/sh" > ~/bin/puma_hunter.sh
  echo "kill -9 \$(lsof -i tcp:3000 -t)" >> ~/bin/puma_hunter.sh
  chmod +x ~/bin/puma_hunter.sh
fi

Run

If you'd like to just run the script right now, you can do this.

# Terminal
~/bin/puma_hunter.sh

Install

You don't have to "install" this if you don't want to. You can keep running it with ~/bin/puma_hunter.sh (or puma_hunter.sh if ~/bin is already on your PATH).

But if you do install it, like so:

# Terminal
cp ~/bin/puma_hunter.sh /usr/local/bin/

Then running it becomes simply this:

# Terminal
puma_hunter.sh

This will probably also work with puma_h<tab> if you've got autocomplete setup correctly in your Terminal.

Uninstall

If you don't appreciate installing some strange code on your computer, then you can do this.

# Terminal
rm -i /usr/local/bin/puma_hunter.sh ~/bin/puma_hunter.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment