From ef01ea45395462b07f012be7421be7990c577f00 Mon Sep 17 00:00:00 2001 From: babylife <31977161+babylife@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:23:03 +0800 Subject: [PATCH 1/3] Update pushplus_check.sh 1. enhace log 2. fix check public ip -V4 --- pushplus/pushplus/scripts/pushplus_check.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pushplus/pushplus/scripts/pushplus_check.sh b/pushplus/pushplus/scripts/pushplus_check.sh index 68524eb0..61184cc2 100755 --- a/pushplus/pushplus/scripts/pushplus_check.sh +++ b/pushplus/pushplus/scripts/pushplus_check.sh @@ -141,8 +141,8 @@ if [[ "${pushplus_info_wan}" == "1" ]]; then router_wan0_gw=$(nvram get wan0_gw_ifname) router_wan0_ip=$(nvram get wan0_ipaddr) if [[ "${pushplus_info_pub}" == "1" ]]; then - router_wan0_ip4=$(curl -4 --interface ${router_wan0_gw} -s http://api.ip.sb/ip 2>&1) - router_wan0_ip6=$(curl -6 --interface ${router_wan0_gw} -s http://api.ip.sb/ip 2>&1) + router_wan0_ip4=$(curl -4 -s http://api.ip.sb/ip 2>&1) + router_wan0_ip6=$(curl -6 -s http://api.ip.sb/ip 2>&1) else router_wan0_ip4=${router_wan0_ip} router_wan0_ip6="" @@ -170,7 +170,7 @@ if [[ "${pushplus_info_wan}" == "1" ]]; then router_wan1_proto=$(nvram get wan1_proto) router_wan1_ip=$(nvram get wan1_ipaddr) if [[ "${pushplus_info_pub}" == "1" ]]; then - router_wan1_ip4=$(curl -4 --interface ${router_wan1_gw} -s http://api.ip.sb/ip 2>&1) + router_wan1_ip4=$(curl -4 -s http://api.ip.sb/ip 2>&1) router_wan1_ip6=$(curl -6 --interface ${router_wan1_gw} -s http://api.ip.sb/ip 2>&1) else router_wan1_ip4=${router_wan1_ip} @@ -413,7 +413,7 @@ if [[ "${pushplus_info_dhcp}" == "1" ]]; then fi echo '}' >>${pushplus_info_text} - +#logger "[pushplus] pushplus_info_text为:${pushplus_info_text}" pushplus_send_content=$(jq -c . ${pushplus_info_text}) pushplus_send_title="${send_title}状态信息" @@ -426,9 +426,12 @@ for nu in ${token_nu}; do url="https://www.pushplus.plus/send/${pushplus_config_token}" reqstr="curl -H \"content-type:application/json\" -X POST -d '{\"template\":\"route\",\"topic\":\""${pushplus_config_topic}"\",\"channel\":\""${pushplus_config_channel}"\",\"title\":\""${pushplus_send_title}"\",\"content\":"${pushplus_send_content}"}' ${url}" result=$(eval ${reqstr}) - if [[ -n "$(echo $result | grep "success")" ]]; then - [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 成功!!" + [ "${pushplus_info_logger}" == "1" ]&& logger "[pushplus] reqstr为:${reqstr}" + if [[ -n "$(echo $result | grep "请求成功")" ]]; then + [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 成功!!,返回结果为:${result}" + #logger "[pushplus] 返回结果为:${result}" else - [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 失败,请检查网络及配置!" + [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 失败,请检查网络及配置!返回结果为:${result}" + #logger "[pushplus] 返回结果为:${result}" fi done From 927827eade1229c3950cf422a0b7120b91cea51f Mon Sep 17 00:00:00 2001 From: babylife <31977161+babylife@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:25:06 +0800 Subject: [PATCH 2/3] Update pushplus_dhcp_trigger.sh Enhance log --- pushplus/pushplus/scripts/pushplus_dhcp_trigger.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pushplus/pushplus/scripts/pushplus_dhcp_trigger.sh b/pushplus/pushplus/scripts/pushplus_dhcp_trigger.sh index 142acf70..cc04ed2b 100755 --- a/pushplus/pushplus/scripts/pushplus_dhcp_trigger.sh +++ b/pushplus/pushplus/scripts/pushplus_dhcp_trigger.sh @@ -150,7 +150,7 @@ for nu in ${token_nu}; do url="https://www.pushplus.plus/send/${pushplus_config_token}" reqstr="curl -H \"content-type:application/json\" -X POST -d '{\"template\":\"route\",\"topic\":\""${pushplus_config_topic}"\",\"channel\":\""${pushplus_config_channel}"\",\"title\":\""${pushplus_send_title}"\",\"content\":"${pushplus_send_content}"}' ${url}" result=$(eval ${reqstr}) - if [[ -n "$(echo $result | grep "success")" ]]; then + if [[ -n "$(echo $result | grep "请求成功")" ]]; then [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 成功!!" else [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 失败,请检查网络及配置!" From 3f335766777248b4682da005891ad3ae9e783956 Mon Sep 17 00:00:00 2001 From: babylife <31977161+babylife@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:26:16 +0800 Subject: [PATCH 3/3] Update pushplus_ifup_trigger.sh enhance log --- pushplus/pushplus/scripts/pushplus_ifup_trigger.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pushplus/pushplus/scripts/pushplus_ifup_trigger.sh b/pushplus/pushplus/scripts/pushplus_ifup_trigger.sh index 6b99c978..c48951e3 100755 --- a/pushplus/pushplus/scripts/pushplus_ifup_trigger.sh +++ b/pushplus/pushplus/scripts/pushplus_ifup_trigger.sh @@ -32,8 +32,8 @@ router_wan0_ifname=$(nvram get wan0_ifname) router_wan0_gw=$(nvram get wan0_gw_ifname) router_wan0_ip=$(nvram get wan0_ipaddr) if [[ "${pushplus_info_pub}" == "1" ]]; then - router_wan0_ip4=$(curl -4 --interface ${router_wan0_gw} -s http://api.ip.sb/ip 2>&1) - router_wan0_ip6=$(curl -6 --interface ${router_wan0_gw} -s http://api.ip.sb/ip 2>&1) + router_wan0_ip4=$(curl -4 -s http://api.ip.sb/ip 2>&1) + router_wan0_ip6=$(curl -6 -s http://api.ip.sb/ip 2>&1) else router_wan0_ip4=${router_wan0_ip} router_wan0_ip6="" @@ -96,10 +96,13 @@ for nu in ${token_nu}; do url="https://www.pushplus.plus/send/${pushplus_config_token}" reqstr="curl -H \"content-type:application/json\" -X POST -d '{\"template\":\"route\",\"topic\":\""${pushplus_config_topic}"\",\"channel\":\""${pushplus_config_channel}"\",\"title\":\""${pushplus_send_title}"\",\"content\":"${pushplus_send_content}"}' ${url}" result=$(eval ${reqstr}) - if [[ -n "$(echo $result | grep "success")" ]]; then - [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 成功!!" + [ "${pushplus_info_logger}" == "1" ]&& logger "[pushplus] reqstr为:${reqstr}" + if [[ -n "$(echo $result | grep "请求成功")" ]]; then + [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 成功!!,返回结果为:${result}" + #logger "[pushplus] 返回结果为:${result}" else - [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 失败,请检查网络及配置!" + [ "${pushplus_info_logger}" == "1" ] && logger "[pushplus]: 网络重启信息推送到 TOKEN No.${nu} 失败,请检查网络及配置!返回结果为:${result}" + #logger "[pushplus] 返回结果为:${result}" fi done sleep 2