From 7293aff6a54e126d633a37dc85decc9192e774d3 Mon Sep 17 00:00:00 2001 From: Dominic Reich Date: Sat, 5 Oct 2024 20:17:06 +0200 Subject: [PATCH] update backup count and counting mechanism --- ubl-arch.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ubl-arch.sh b/ubl-arch.sh index 071dc60..6b0320d 100755 --- a/ubl-arch.sh +++ b/ubl-arch.sh @@ -1,6 +1,6 @@ #!/bin/sh # 2024-05-26 -# lastmod: 2024-09-08 +# lastmod: 2024-10-05 # Dominic Reich BFILE=/srv/http/blocked.txt @@ -16,13 +16,13 @@ OLDNUM=$(sudo ipset --terse -L | grep "Number of entries:" | cut -d: -f2 | xargs while read ip; do sudo ipset -exist -A badips "$ip"; done < $IPFILE -FILEBACKUP=14 +FILEBACKUP=3 if [ ${FILEBACKUP} -ne 0 ]; then sudo cp ${BFILE} ${BFILE}.$(date +%Y%m%d) fi -BACKUPCOUNT=$(ls ${BFILE}* | wc -l) +BACKUPCOUNT=$(ls ${BFILE}.* | wc -l) BACKUPSTODELETE=$(expr ${BACKUPCOUNT} - ${FILEBACKUP}) if [ ${BACKUPCOUNT} -gt ${FILEBACKUP} ]; then for f in $(ls -tr ${BFILE}.* | head -${BACKUPSTODELETE})