feat(脚本): 兼容centos6、增加状态展示、增加版本号、增加卸载

pull/534/merge
mack-a 2020-07-21 14:03:18 +08:00
parent 5cbcb43e19
commit a24a1ec7bb
2 changed files with 63 additions and 8 deletions

View File

@ -28,7 +28,7 @@
* * *
# 一键脚本
## 全自动WebSocket+TLS+CDN+智能优选Cloudflare IP一键脚本
- 目前已在GCP上测试Centos7、Centos8、Debian9、Debian10通过不开启云朵则为直连。
- 目前已在GCP上测试Centos6【不稳定】、Centos7、Centos8、Debian9、Debian10通过不开启云朵则为直连。
- 这里添加了默认的智能解析自选CDN IP脚本安装时可手动选择是否使用本地dns解析建议使用114.114.114.114
- 如果智能解析后发现不能上网第一可以升级客户端、第二可以将address填写自己的科学上网的域名不再使用智能解析CDN的域名。
- 如果对默认的不满意,则可以[点此查看最新的](https://github.com/mack-a/v2ray-agent/blob/master/optimize_V2Ray.md),或者加入[TG群](https://t.me/technologyshare)添加适合自己的CDN ip。

View File

@ -88,7 +88,12 @@ installTools(){
sed -i "${acmeBashrcLine}d" /root/.bashrc
fi
rm -rf /etc/systemd/system/v2ray.service
systemctl daemon-reload
if [[ ! -z `find /bin -name "systemctl"` ]]
then
systemctl daemon-reload
else
echo 'Centos6'
fi
# rm -rf ~/.acme.sh > /dev/null
echoContent green " 删除完成"
@ -350,11 +355,22 @@ installV2Ray(){
mkdir -p /usr/bin/v2ray/
cp /tmp/v2ray/v2ray /usr/bin/v2ray/ && cp /tmp/v2ray/v2ctl /usr/bin/v2ray/
fi
installV2RayService
if [[ ! -z `find /bin -name "systemctl"` ]]
then
installV2RayService
fi
initV2RayConfig $2
systemctl daemon-reload
systemctl enable v2ray.service
systemctl start v2ray.service
if [[ ! -z `find /bin -name "systemctl"` ]]
then
systemctl daemon-reload
systemctl enable v2ray.service
systemctl start v2ray.service
else
/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json &
fi
if [[ -z `ps -ef|grep v2ray|grep -v grep` ]]
then
echoContent red " V2Ray启动失败请检查日志后重新执行脚本--->"
@ -392,6 +408,7 @@ installV2Ray(){
# 开机自启
installV2RayService(){
echoContent skyBlue " 配置V2Ray开机自启--->"
mkdir -p /etc/systemd/system/
rm -rf /etc/systemd/system/v2ray.service
touch /etc/systemd/system/v2ray.service
@ -518,6 +535,15 @@ progressTool(){
done
echoContent green " $1已安装--->"
}
# 卸载安装的内容
removeInstall(){
rm -rf /tmp/v2ray
rm -rf /tmp/tls
rm -rf /etc/v2ray
rm -rf /root/.acme.sh
echo ${removeType},${installType}
`${removeType} nginx` > /dev/null 2>&1
}
init(){
cd
echoContent red "=============================================================="
@ -526,6 +552,8 @@ init(){
echo
echoContent green "作者mack-a [https://t.me/mack_a]"
echo
echoContent green "Versionv1.0.1"
echo
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echo
echoContent green "TGhttps://t.me/technologyshare"
@ -574,7 +602,7 @@ init(){
echoContent yellow " /etc/nginx/v2ray-agent-https/${domain}.key"
echoContent yellow " /etc/nginx/v2ray-agent-https/${domain}.crt"
else
echoContent yellow " 暂未安装"
echoContent yellow " 暂未安装或未使用最新的脚本安装"
fi
echoContent green "\n定时任务相关文件路径"
@ -585,7 +613,28 @@ init(){
echoContent yellow " 定时任务日志路径:/tmp/tls/tls.log"
echoContent yellow " acme.sh日志路径/tmp/tls/acme.log"
else
echoContent yellow " 暂未安装"
echoContent yellow " 暂未安装或未使用最新的脚本安装"
fi
echoContent green "\n软件运行状态"
if [[ ! -z `ps -ef|grep -v grep|grep nginx` ]]
then
echoContent yellow " Nginx:【运行中】"
elif [[ ! -z `find /usr/sbin/ -name 'nginx'` ]]
then
echoContent yellow " Nginx:【未运行】执行【nginx】运行"
else
echoContent yellow " Nginx:【未安装】"
fi
if [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]]
then
echoContent yellow " V2Ray:【运行中】"
elif [[ ! -z `find /usr/bin/v2ray/ -name 'v2ray'` ]]
then
echoContent yellow " V2Ray:【未运行】,执行【/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json &】运行"
else
echoContent yellow " V2Ray:【未安装】"
fi
@ -616,6 +665,7 @@ init(){
fi
echoContent yellow " 3.BBR安装[推荐BBR+FQ 或者 BBR+Cake]"
echoContent yellow " 4.完全卸载[清理Nginx、TLS证书、V2Ray、acme.sh]"
echoContent red "=============================================================="
echoContent green "请输入上列数字,[任意]结束:"
read installStatus
@ -647,6 +697,11 @@ init(){
else
init
fi
elif [[ "${installStatus}" = "4" ]]
then
removeInstall
echoContent yellow "卸载完成"
exit 0;
else
echoContent yellow "欢迎下次使用--->"
exit 0;