add check caddy run status

pull/20/head
233boy 7 years ago
parent e33bef1806
commit 6222e9d5c2
  1. 15
      v2ray.sh

@ -10,7 +10,7 @@ none='\e[0m'
# Root # Root
[[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1
_version="v1.61" _version="v1.62"
cmd="apt-get" cmd="apt-get"
@ -89,13 +89,18 @@ old_id="23332333-2333-2333-2333-233boy233boy"
v2ray_server_config="/etc/v2ray/config.json" v2ray_server_config="/etc/v2ray/config.json"
v2ray_client_config="/etc/v2ray/233blog_v2ray_config.json" v2ray_client_config="/etc/v2ray/233blog_v2ray_config.json"
v2ray_pid=$(ps ux | grep "/usr/bin/v2ray/v2ray" | grep -v grep | awk '{print $2}') v2ray_pid=$(ps ux | grep "/usr/bin/v2ray/v2ray" | grep -v grep | awk '{print $2}')
caddy_pid=$(pgrep "caddy") caddy_pid=$(ps ux | grep "/usr/local/bin/caddy" | grep -v grep | awk '{print $2}')
if [ $v2ray_pid ]; then if [ $v2ray_pid ]; then
v2ray_status="$green正在运行$none" v2ray_status="$green正在运行$none"
else else
v2ray_status="$red未在运行$none" v2ray_status="$red未在运行$none"
fi fi
if [[ $v2ray_transport == "4" && $caddy_installed ]] && [[ $caddy_pid ]]; then
caddy_run_status="$green正在运行$none"
else
caddy_run_status="$red未在运行$none"
fi
transport=( transport=(
TCP TCP
@ -3618,7 +3623,11 @@ Q | ssqr)
;; ;;
status) status)
echo echo
echo -e " V2Ray 状态: $v2ray_status" if [[ $v2ray_transport == "4" && $caddy_installed ]]; then
echo -e " V2Ray 状态: $v2ray_status / Caddy 状态: $caddy_run_status"
else
echo -e " V2Ray 状态: $v2ray_status"
fi
echo echo
;; ;;
start) start)

Loading…
Cancel
Save