Hunts down and kill
s loose Puma Rails server processes.
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
If you'd like to just run the script right now, you can do this.
# Terminal
~/bin/puma_hunter.sh
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.
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