Last active
October 13, 2020 11:01
-
-
Save mkows/1c1250bd21a7ba9ecfaf3bb79f9b3493 to your computer and use it in GitHub Desktop.
Kill process on port (8080)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCESS_PHRASE="*:8080 (LISTEN)" | |
PROCESS_LINE=`lsof -Pn | grep "$PROCESS_PHRASE"` | |
if [[ -n $PROCESS_LINE ]]; then | |
PROCESS_ID=`awk '{print $2}' <<< $PROCESS_LINE` | |
echo "Killing process id=$PROCESS_ID ('$PROCESS_LINE')" | |
else | |
echo "No matching process found for '$PROCESS_PHRASE'" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment