Update Fail2Ban-Report-cronscript.sh

This commit is contained in:
SubleXBle
2025-08-25 21:21:32 +02:00
committed by GitHub
parent 422d5b683e
commit 4d24cd6a5e

View File

@@ -3,22 +3,26 @@
LOGFILE="/opt/Fail2Ban-Report/cronjobs.log"
echo "----- cronrun start ------" >> $LOGFILE
echo "----- cronrun start ------ $(date '+%Y-%m-%d %H:%M:%S')" >> "$LOGFILE"
# Step 1: JSON generation
./fail2ban_log2json.sh >> $LOGFILE 2>&1
echo "📝 Step 1: Generating JSON from Fail2Ban logs..." >> "$LOGFILE"
./fail2ban_log2json.sh >> "$LOGFILE" 2>&1
sleep 5
# Step 2: Check for updates
./download-checker.sh >> $LOGFILE 2>&1
echo "🔎 Step 2: Checking for updates..." >> "$LOGFILE"
./download-checker.sh >> "$LOGFILE" 2>&1
DOWNLOAD_STATUS=$?
# Step 3: If Updates available run sync cycle
# Step 3: Run firewall & sync only if updates available
if [ $DOWNLOAD_STATUS -eq 0 ]; then
echo "✅ Updates found, running sync cycle" >> $LOGFILE
./firewall-update.sh >> $LOGFILE 2>&1 && ./syncback.sh >> $LOGFILE 2>&1
echo "✅ Updates found, running sync cycle..." >> "$LOGFILE"
./firewall-update.sh >> "$LOGFILE" 2>&1
./syncback.sh >> "$LOGFILE" 2>&1
else
echo " No Updates, firewall & syncback skipped" >> $LOGFILE
echo " No Updates, firewall & syncback skipped" >> "$LOGFILE"
fi
echo "----- cronrun done! ------" >> $LOGFILE
# Step 4: Always mark end of cronrun
echo "----- cronrun done! ------ $(date '+%Y-%m-%d %H:%M:%S')" >> "$LOGFILE"