|
|
@ -1,6 +1,6 @@
|
|
|
|
#!/bin/sh
|
|
|
|
#!/bin/sh
|
|
|
|
# 2024-05-26
|
|
|
|
# 2024-05-26
|
|
|
|
# lastmod: 2024-09-08
|
|
|
|
# lastmod: 2024-10-05
|
|
|
|
# Dominic Reich
|
|
|
|
# Dominic Reich
|
|
|
|
|
|
|
|
|
|
|
|
BFILE=/srv/http/blocked.txt
|
|
|
|
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
|
|
|
|
while read ip; do sudo ipset -exist -A badips "$ip"; done < $IPFILE
|
|
|
|
|
|
|
|
|
|
|
|
FILEBACKUP=14
|
|
|
|
FILEBACKUP=3
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${FILEBACKUP} -ne 0 ]; then
|
|
|
|
if [ ${FILEBACKUP} -ne 0 ]; then
|
|
|
|
sudo cp ${BFILE} ${BFILE}.$(date +%Y%m%d)
|
|
|
|
sudo cp ${BFILE} ${BFILE}.$(date +%Y%m%d)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
BACKUPCOUNT=$(ls ${BFILE}* | wc -l)
|
|
|
|
BACKUPCOUNT=$(ls ${BFILE}.* | wc -l)
|
|
|
|
BACKUPSTODELETE=$(expr ${BACKUPCOUNT} - ${FILEBACKUP})
|
|
|
|
BACKUPSTODELETE=$(expr ${BACKUPCOUNT} - ${FILEBACKUP})
|
|
|
|
if [ ${BACKUPCOUNT} -gt ${FILEBACKUP} ]; then
|
|
|
|
if [ ${BACKUPCOUNT} -gt ${FILEBACKUP} ]; then
|
|
|
|
for f in $(ls -tr ${BFILE}.* | head -${BACKUPSTODELETE})
|
|
|
|
for f in $(ls -tr ${BFILE}.* | head -${BACKUPSTODELETE})
|
|
|
|