#!/usr/bin/sh #echo $# if test $# -ne 1 then echo Usage: stop-port.sh port echo Example: ./stop-port.sh 8081 exit fi port=$1 pid=`netstat -npa|grep LISTEN|grep $port|awk '{print $7}'|awk -F '/' '{print $1}'` if [ -z $pid ] then echo 'service not start!' else kill $pid echo $pid echo 'service is killed!' fi