Sample Header Ad - 728x90

Kill any service running at a specific port

29 votes
4 answers
162033 views
I am trying to write a script that kills service running at a specific port. This is my script: a=$(ps ax | grep 4990 | grep java | awk '{print $1}') kill -9 $a It's a java program. This script works sometimes, but mysteriously fails most of the time. Is there any other way to kill a service running on a port? My port is 4990.
Asked by Abhishek dot py (2403 rep)
Jul 3, 2014, 05:25 AM
Last activity: Jan 12, 2025, 07:47 PM