init: Fix empty zapret-hosts-user.txt on start daemons

This commit is contained in:
remittor
2025-02-25 10:41:38 +03:00
parent d234b5f762
commit 6deb6f70fb

View File

@@ -145,6 +145,12 @@ function insert_cron_task_logs
function init_before_start function init_before_start
{ {
local DAEMON_LOG_ENABLE=$1 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 644 $ZAPRET_BASE/ipset/*.txt
chmod 666 $ZAPRET_BASE/ipset/*.log chmod 666 $ZAPRET_BASE/ipset/*.log
rm -f /tmp/zapret*.log rm -f /tmp/zapret*.log