Skip to content

Instantly share code, notes, and snippets.

@reimai
Last active December 21, 2015 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reimai/b8c5b7086cb9c7e64b17 to your computer and use it in GitHub Desktop.
Save reimai/b8c5b7086cb9c7e64b17 to your computer and use it in GitHub Desktop.
kills whoever is listening on 5005, maven debug sometimes fails to free the damn port
#!/bin/bash
#automated killing of maven debug plugin
#or anyone else if the port was specified
port=${1:-5005}
pid=`lsof -t -i :$port | tr -s ' ' | cut -d ' ' -f 2`
if [[ -z $pid ]]; then
echo "no one to kill 8'("
else
echo "killing process listening on port $port \n`ps hp $pid`"
kill -9 $pid
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment