check v2ray run status

pull/171/head
233boy 6 years ago
parent a4ca589613
commit dc914f839e
  1. 9
      src/v2ray-info.sh
  2. 33
      v2ray.sh

@ -132,10 +132,19 @@ _v2_info() {
echo " 备注: 广告拦截已开启.." echo " 备注: 广告拦截已开启.."
echo echo
fi fi
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
else
echo "---------- END -------------" echo "---------- END -------------"
echo echo
echo "V2Ray 客户端使用教程: https://${_site}/post/4/" echo "V2Ray 客户端使用教程: https://${_site}/post/4/"
echo echo
echo -e "提示: 输入$cyan v2ray url $none可生成 vmess URL 链接 / 输入$cyan v2ray qr $none可生成二维码链接" echo -e "提示: 输入$cyan v2ray url $none可生成 vmess URL 链接 / 输入$cyan v2ray qr $none可生成二维码链接"
echo echo
fi
} }

@ -818,7 +818,6 @@ change_ssray_config() {
if [[ $ssray ]]; then if [[ $ssray ]]; then
while :; do while :; do
echo echo
echo -e "$yellow 1. $none修改 Shadowsocks - V2ray插件 端口" echo -e "$yellow 1. $none修改 Shadowsocks - V2ray插件 端口"
@ -991,7 +990,7 @@ change_vmess_user () {
read -p "[默认:64]" new_alterId read -p "[默认:64]" new_alterId
[[ -z $new_alterId ]] && new_alterId=64 [[ -z $new_alterId ]] && new_alterId=64
if [[ $new_alterId =~ ^[0-9]+$ ]]; then if [[ $new_alterId =~ ^[0-9]+$ ]]; then
break; break
else else
_red "$new_alterId 是啥???" _red "$new_alterId 是啥???"
fi fi
@ -2325,13 +2324,17 @@ start_v2ray() {
# systemctl start v2ray # systemctl start v2ray
service v2ray start >/dev/null 2>&1 service v2ray start >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo echo
echo -e "${red} V2Ray 启动失败!$none" echo '正在启动....'
echo
sleep 3
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 启动失败!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo echo
else else
echo echo
echo -e "${green} V2Ray 已启动$none" _green " V2Ray 启动成功!!!!"
echo echo
fi fi
@ -2353,13 +2356,17 @@ stop_v2ray() {
restart_v2ray() { restart_v2ray() {
# systemctl restart v2ray # systemctl restart v2ray
service v2ray restart >/dev/null 2>&1 service v2ray restart >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo echo
echo -e "${red} V2Ray 重启失败!$none" echo '正在重启....'
echo
sleep 3
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 重启失败!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo echo
else else
echo echo
echo -e "${green} V2Ray 重启完成 $none" _green " V2Ray 重启成功!!!!"
echo echo
fi fi
} }
@ -3008,7 +3015,15 @@ reload)
config config
[[ $v2ray_transport == [45] && $caddy ]] && caddy_config [[ $v2ray_transport == [45] && $caddy ]] && caddy_config
clear clear
view_v2ray_config_info if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 加载失败!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
else
echo
_green " V2Ray 加载成功!!! 如需查看 V2Ray 配置请使用 v2ray info"
echo
fi
;; ;;
time) time)
_load sys-info.sh _load sys-info.sh

Loading…
Cancel
Save