Skip to main content

Posts

Showing posts from March, 2013

Find and Kill PID in Fedora

Hi friends... Following shell script  part will find the process id which process running on a given port (e.g. in my example it's 8080) and kill the process. x=$(netstat -nap | grep java | grep :8080 | awk '{printf("%s\n", substr($7, 1, index($7, "/") - 1))}') if [$x eq '']; then     echo "---> [INFO] --- Application server not running in port 8080..." else     kill -9 $x     echo "---> [INFO] --- Application server running in port 8080 and kill in process #" $x fi