From c090508bba8003062fbf738ef8d1e38b4c6eec82 Mon Sep 17 00:00:00 2001 From: CHIZI-0618 <51962278+CHIZI-0618@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:54:02 +0800 Subject: [PATCH] fix: fix log output --- box/scripts/net.inotify | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/box/scripts/net.inotify b/box/scripts/net.inotify index 915c9b0..34f7e48 100755 --- a/box/scripts/net.inotify +++ b/box/scripts/net.inotify @@ -15,8 +15,10 @@ rules_add() { iptables -t mangle -F LOCAL_IP_V4 ip -4 a | awk '/inet/ {print $2}' | grep -vE "^127.0.0.1" | while read -r local_ipv4 ; do iptables -w 100 -t mangle -A LOCAL_IP_V4 -d $local_ipv4 -j ACCEPT + rv1=$? iptables -w 100 -t nat -A LOCAL_IP_V4 -d $local_ipv4 -j ACCEPT - [ $? = "0" ] && echo "$(date +"[%Y-%m-%d %H:%M:%S %Z]") [Info]: local ip is $local_ipv4, anti-loopback rule has been inserted" >> ${run_path}/run.log 2>> ${run_path}/run_error.log + rv2=$? + ( [ $rv1 = "0" ] || [ $rv2 = "0" ] ) && echo "$(date +"[%Y-%m-%d %H:%M:%S %Z]") [Info]: local ip is $local_ipv4, anti-loopback rule has been inserted" >> ${run_path}/run.log 2>> ${run_path}/run_error.log done ip6tables -t mangle -F LOCAL_IP_V6