mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-19 15:33:06 +01:00
remove oldest backup
This commit is contained in:
@@ -40,7 +40,7 @@ fi
|
||||
|
||||
# Find oldest backup file and remove it
|
||||
NUMBACKUPS=$(find /nsm/backup/ -type f -name "so-config-backup*" | wc -l)
|
||||
OLDESTBACKUP=$(find /nsm/backup/ -type f -name "so-config-backup*" | ls -1t | tail -1)
|
||||
OLDESTBACKUP=$(find /nsm/backup/ -type f -name "so-config-backup*" -type f -printf '%T+ %p\n' | sort | head -n 1 | awk -F" " '{print $2}')
|
||||
if [ "$NUMBACKUPS" -gt "$MAXBACKUPS" ]; then
|
||||
rm -f /nsm/backup/$OLDESTBACKUP
|
||||
rm -f $OLDESTBACKUP
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user