16 lines
412 B
Bash
Executable File
16 lines
412 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
BACKUP_DIR="$CURRENT_DIR/backups"
|
|
|
|
##
|
|
# Verify there is at least 5 backups
|
|
BACKUPS=$(/usr/bin/find "$BACKUP_DIR" -name "*.zip" -print | wc -l)
|
|
|
|
if (( BACKUPS < 5 )); then
|
|
echo "There is less than five backups so we won't prune!"
|
|
exit 1
|
|
fi
|
|
|
|
/usr/bin/find "$BACKUP_DIR" -mtime +5 -name "gitea-dump-*.zip" -exec /bin/rm '{}' \;
|