From 2c64a97a6d06db2349629cd136437c48a2c8a7ba Mon Sep 17 00:00:00 2001 From: frankiejun Date: Tue, 13 Aug 2024 22:00:13 +0800 Subject: [PATCH] fixed --- keepalive.sh | 14 ++++++-------- revive.sh | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/keepalive.sh b/keepalive.sh index 698ffb8..38c71b7 100755 --- a/keepalive.sh +++ b/keepalive.sh @@ -35,29 +35,27 @@ checkvmessAlive() { #main cd ${installpath}/serv00-play/ if [ ! -f config.json ]; then - echo "未配置保活项目,请先行配置!" + echo "未配置保活项目,请先行配置!" >>a.log exit 0 fi monitor=$(jq -r ".item[]" config.json) -for obj in $monitor; do - cd ${installpath}/serv00-play/ - echo "obj: $obj" +for obj in "${monitor[@]}"; do if [ "$obj" == "vless" ]; then if ! checkvlessAlive; then cd ${installpath}/serv00-play/vless if ! ./start.sh; then - echo "RESPONSE:vless restarted failure." + echo "RESPONSE:vless restarts failure." else - echo "RESPONSE:vless restarted successfully." + echo "RESPONSE:vless restarts successfully." fi fi elif [ "$obj" == "vmess" ]; then if ! checkvmessAlive; then cd ${installpath}/serv00-play/vmess if ! ./start.sh; then - echo "RESPONSE:vmess restarted failure." + echo "vmess restarts failure." else - echo "RESPONSE:vmess restarted successfully." + echo "vmess restarts successfully." fi fi fi diff --git a/revive.sh b/revive.sh index d0370d4..d28e61f 100755 --- a/revive.sh +++ b/revive.sh @@ -13,7 +13,7 @@ sendtype=$SENDTYPE #}' #echo "host info:$HOSTS_JSON" # 使用 jq 提取 JSON 数组,并将其加载为 Bash 数组 -mapfile -t hosts_info < <(echo "${HOSTS_JSON}" | jq -r ".info[]") +hosts_info=($(echo "${HOSTS_JSON}" | jq -c ".info[]")) for info in "${hosts_info[@]}"; do user=$(echo $info | jq -r ".username")