mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 重构
parent
3a3d460081
commit
17f76bb557
17
install.sh
17
install.sh
|
@ -271,7 +271,7 @@ installTLS(){
|
||||||
|
|
||||||
cp -R /etc/nginx/v2ray-agent-https/config /etc/v2ray-agent/tls/config
|
cp -R /etc/nginx/v2ray-agent-https/config /etc/v2ray-agent/tls/config
|
||||||
cp -R /etc/nginx/v2ray-agent-https/${domain}.crt /etc/v2ray-agent/tls/${domain}.crt
|
cp -R /etc/nginx/v2ray-agent-https/${domain}.crt /etc/v2ray-agent/tls/${domain}.crt
|
||||||
cp -R /etc/nginx/v2ray-agent-https/$1.key /etc/v2ray-agent/tls/${domain}.key
|
cp -R /etc/nginx/v2ray-agent-https/${domain}.key /etc/v2ray-agent/tls/${domain}.key
|
||||||
progressTools "yellow" " TLS证书备份成功,证书位置:/etc/v2ray-agent/tls--->"
|
progressTools "yellow" " TLS证书备份成功,证书位置:/etc/v2ray-agent/tls--->"
|
||||||
elif [[ -z `cat /etc/v2ray-agent/tls/${domain}.crt` ]] || [[ -z `cat /etc/v2ray-agent/tls/${domain}.key` ]]
|
elif [[ -z `cat /etc/v2ray-agent/tls/${domain}.crt` ]] || [[ -z `cat /etc/v2ray-agent/tls/${domain}.key` ]]
|
||||||
then
|
then
|
||||||
|
@ -290,7 +290,7 @@ initNginxConfig(){
|
||||||
installType=$1
|
installType=$1
|
||||||
if [[ "${installType}" = "WSS" ]]
|
if [[ "${installType}" = "WSS" ]]
|
||||||
then
|
then
|
||||||
cat << EOF > /etc/nginx/conf.d/alone.conf
|
cat << EOF > /etc/nginx/conf.d/alone.conf
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name ${domain};
|
server_name ${domain};
|
||||||
|
@ -321,6 +321,7 @@ cat << EOF > /etc/nginx/conf.d/alone.conf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
elif [[ "${installType}" = "vlessTCP" ]]
|
elif [[ "${installType}" = "vlessTCP" ]]
|
||||||
then
|
then
|
||||||
echo vlessTCP
|
echo vlessTCP
|
||||||
|
@ -354,7 +355,7 @@ nginxBlog(){
|
||||||
}
|
}
|
||||||
# 操作Nginx
|
# 操作Nginx
|
||||||
handleNginx(){
|
handleNginx(){
|
||||||
if [[ !-z `ps -ef|grep -v grep|grep nginx` ]] && [[ "$1"="start" ]]
|
if [[ ! -z `ps -ef|grep -v grep|grep nginx` ]] && [[ "$1" = "start" ]]
|
||||||
then
|
then
|
||||||
nginx
|
nginx
|
||||||
if [[ -z `ps -ef|grep -v grep|grep nginx` ]]
|
if [[ -z `ps -ef|grep -v grep|grep nginx` ]]
|
||||||
|
@ -362,7 +363,7 @@ handleNginx(){
|
||||||
progressTools "red" " Nginx启动失败,请检查日志--->"
|
progressTools "red" " Nginx启动失败,请检查日志--->"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
elif [[ "$1"="stop" ]] && [[ !-z `ps -ef|grep -v grep|grep nginx` ]]
|
elif [[ "$1" = "stop" ]] && [[ ! -z `ps -ef|grep -v grep|grep nginx` ]]
|
||||||
then
|
then
|
||||||
nginx -s stop
|
nginx -s stop
|
||||||
fi
|
fi
|
||||||
|
@ -525,14 +526,14 @@ handleV2Ray(){
|
||||||
if [[ -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "start" ]]
|
if [[ -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "start" ]]
|
||||||
then
|
then
|
||||||
/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json & > /dev/null 2>&1
|
/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json & > /dev/null 2>&1
|
||||||
elif [[ !-z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "stop" ]]
|
elif [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "stop" ]]
|
||||||
then
|
then
|
||||||
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9
|
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ "$1" = "start" ]]
|
if [[ "$1" = "start" ]]
|
||||||
then
|
then
|
||||||
if [[ !-z `ps -ef|grep -v grep|grep v2ray` ]]
|
if [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]]
|
||||||
then
|
then
|
||||||
echoContent green "V2Ray启动成功" no
|
echoContent green "V2Ray启动成功" no
|
||||||
else
|
else
|
||||||
|
@ -973,8 +974,8 @@ menu(){
|
||||||
echoContent yellow "5.安装BBR" "no"
|
echoContent yellow "5.安装BBR" "no"
|
||||||
echoContent yellow "6.卸载脚本" "no"
|
echoContent yellow "6.卸载脚本" "no"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
installTools
|
read -p "请选择:"
|
||||||
|
installV2RayWSSNginxWeb
|
||||||
exit 0;
|
exit 0;
|
||||||
# ===============
|
# ===============
|
||||||
# todo 这里判断每次安装的内容
|
# todo 这里判断每次安装的内容
|
||||||
|
|
Loading…
Reference in New Issue