mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
已添加 scripts/libs/check_port.sh
This commit is contained in:
17
scripts/libs/check_port.sh
Normal file
17
scripts/libs/check_port.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
|
||||
if [ $1 -gt 65535 -o $1 -le 1 ]; then
|
||||
echo -e "\033[31m输入错误!请输入正确的数值(1-65535)!\033[0m"
|
||||
exit 1
|
||||
elif [ -n "$(echo "|$mix_port|$redir_port|$dns_port|$db_port|" | grep "|$1|")" ]; then
|
||||
echo -e "\033[31m输入错误!请不要输入重复的端口!\033[0m"
|
||||
exit 1
|
||||
elif [ -n "$(netstat -ntul | grep ":$1 ")" ]; then
|
||||
echo -e "\033[31m当前端口已被其他进程占用,请重新输入!\033[0m"
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user