This commit is contained in:
smart
2025-12-05 21:51:55 +08:00
parent e0bc2069e0
commit 9181fbf744
420 changed files with 101541 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
#!/bin/sh
portnb="6801";
sumnb="1";
usage() {
if [ "$*" ]; then
echo
echo "$*"
fi
echo "Usage: ${NAME} [-p] [-s] ";
echo " -p port number";
echo " Default: 6801";
echo " -n port sum,start for [-p]6801";
echo " Default: 20";
exit 2
}
while [ "$*" ]; do
param=$1; shift; OPTARG=$1
case $param in
-p) portnb="${OPTARG}"; shift ;;
-n) sumnb="${OPTARG}"; shift ;;
-h|--help) usage ;;
-*) usage "Unknown chrooter option: ${param}" ;;
*) break ;;
esac
done
expr $portnb "+" 10 &> /dev/null
if [ $? -eq 0 ];then
echo -e "\033[34;5;5mkill port exec!\033[0m ";
else
echo "[-p]erro : please input a number!";
exit 2;
fi
expr $sumnb "+" 10 &> /dev/null
if [ $? -eq 0 ];then
echo -e "\033[34;5;5mkill port exec!\033[0m ";
else
echo "[-n]erro : please input a number!";
exit 2;
fi
for i in `seq 1 $sumnb`;do
typeset -i port=$portnb-1+i
vwport=`netstat -tlnp | grep ":"$port`;
if [ -n "$vwport" ];then
echo -e "kill port : \033[32;5;5m$port\033[0m succeed! ";
kill -9 `lsof -ti":$port"`;
fi
done