feat(脚本): 优化xray、v2ray启动时的等待时间、添加安装时可自定义uuid

pull/534/merge
mack-a 2021-03-23 11:45:05 +08:00
parent 8d51a37edb
commit 65ee351727
1 changed files with 35 additions and 7 deletions

View File

@ -1253,7 +1253,7 @@ handleV2Ray() {
systemctl stop v2ray.service systemctl stop v2ray.service
fi fi
fi fi
sleep 0.5 sleep 0.8
if [[ "$1" == "start" ]]; then if [[ "$1" == "start" ]]; then
if [[ -n $(pgrep -f "v2ray/v2ray") ]]; then if [[ -n $(pgrep -f "v2ray/v2ray") ]]; then
@ -1283,7 +1283,7 @@ handleXray() {
fi fi
fi fi
sleep 0.5 sleep 0.8
if [[ "$1" == "start" ]]; then if [[ "$1" == "start" ]]; then
if [[ -n $(pgrep -f "xray/xray") ]]; then if [[ -n $(pgrep -f "xray/xray") ]]; then
@ -1363,10 +1363,21 @@ handleTrojanGo() {
fi fi
fi fi
} }
# 初始化V2Ray 配置文件 # 初始化V2Ray 配置文件
initV2RayConfig() { initV2RayConfig() {
echoContent skyBlue "\n进度 $2/${totalProgress} : 初始化V2Ray配置" echoContent skyBlue "\n进度 $2/${totalProgress} : 初始化V2Ray配置"
if [[ -n "${currentUUID}" ]]; then echo
read -r -p "是否自定义UUID [y/n]:" customUUIDStatus
echo
if [[ "${customUUIDStatus}" == "y" ]]; then
read -r -p "请输入合法的UUID:" currentCustomUUID
if [[ -n "${currentCustomUUID}" ]]; then
uuid=${currentCustomUUID}
fi
fi
if [[ -n "${currentUUID}" && -z "${uuid}" ]]; then
echo echo
read -r -p "读取到上次安装记录是否使用上次安装时的UUID [y/n]:" historyUUIDStatus read -r -p "读取到上次安装记录是否使用上次安装时的UUID [y/n]:" historyUUIDStatus
if [[ "${historyUUIDStatus}" == "y" ]]; then if [[ "${historyUUIDStatus}" == "y" ]]; then
@ -1374,7 +1385,7 @@ initV2RayConfig() {
else else
uuid=$(/etc/v2ray-agent/v2ray/v2ctl uuid) uuid=$(/etc/v2ray-agent/v2ray/v2ctl uuid)
fi fi
else elif [[ -z "${uuid}" ]]; then
uuid=$(/etc/v2ray-agent/v2ray/v2ctl uuid) uuid=$(/etc/v2ray-agent/v2ray/v2ctl uuid)
fi fi
@ -1652,7 +1663,18 @@ EOF
# 初始化Xray 配置文件 # 初始化Xray 配置文件
initXrayConfig() { initXrayConfig() {
echoContent skyBlue "\n进度 $2/${totalProgress} : 初始化Xray配置" echoContent skyBlue "\n进度 $2/${totalProgress} : 初始化Xray配置"
if [[ -n "${currentUUID}" ]]; then echo
read -r -p "是否自定义UUID [y/n]:" customUUIDStatus
echo
if [[ "${customUUIDStatus}" == "y" ]]; then
read -r -p "请输入合法的UUID:" currentCustomUUID
if [[ -n "${currentCustomUUID}" ]]; then
uuid=${currentCustomUUID}
fi
fi
if [[ -n "${currentUUID}" && -z "${uuid}" ]]; then
echo echo
read -r -p "读取到上次安装记录是否使用上次安装时的UUID [y/n]:" historyUUIDStatus read -r -p "读取到上次安装记录是否使用上次安装时的UUID [y/n]:" historyUUIDStatus
if [[ "${historyUUIDStatus}" == "y" ]]; then if [[ "${historyUUIDStatus}" == "y" ]]; then
@ -1660,9 +1682,10 @@ initXrayConfig() {
else else
uuid=$(/etc/v2ray-agent/xray/xray uuid) uuid=$(/etc/v2ray-agent/xray/xray uuid)
fi fi
else elif [[ -z "${uuid}" ]]; then
uuid=$(/etc/v2ray-agent/xray/xray uuid) uuid=$(/etc/v2ray-agent/xray/xray uuid)
fi fi
if [[ -z "${uuid}" ]]; then if [[ -z "${uuid}" ]]; then
echoContent red "\n ---> uuid读取错误重新生成" echoContent red "\n ---> uuid读取错误重新生成"
uuid=$(/etc/v2ray-agent/xray/xray uuid) uuid=$(/etc/v2ray-agent/xray/xray uuid)
@ -2183,6 +2206,11 @@ showAccounts() {
fi fi
} }
# 状态展示
#showInstallStatus() {
#
#}
# 更新伪装站 # 更新伪装站
updateNginxBlog() { updateNginxBlog() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点" echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点"
@ -3505,7 +3533,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.4.4" echoContent green "当前版本v2.4.5"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本" echoContent green "描述:七合一共存脚本"
echoContent red "==============================================================" echoContent red "=============================================================="