From 6deb6f70fbaf3550ccb763f33920612a5e7557fb Mon Sep 17 00:00:00 2001 From: remittor Date: Tue, 25 Feb 2025 10:41:38 +0300 Subject: [PATCH] init: Fix empty zapret-hosts-user.txt on start daemons --- zapret/comfunc.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zapret/comfunc.sh b/zapret/comfunc.sh index 50e3fbd..dc85079 100755 --- a/zapret/comfunc.sh +++ b/zapret/comfunc.sh @@ -145,6 +145,12 @@ function insert_cron_task_logs function init_before_start { local DAEMON_LOG_ENABLE=$1 + local HOSTLIST_FN="$ZAPRET_BASE/ipset/zapret-hosts-user.txt" + [ ! -f "$HOSTLIST_FN" ] && touch "$HOSTLIST_FN" + local HOSTLIST_SZ=$( wc -c < "$HOSTLIST_FN" ) + if [ "$HOSTLIST_SZ" -le 3 ]; then + echo "abra-cadabra.com" > "$HOSTLIST_FN" + fi chmod 644 $ZAPRET_BASE/ipset/*.txt chmod 666 $ZAPRET_BASE/ipset/*.log rm -f /tmp/zapret*.log