The repo I use to run gitea and caddy all in docker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
412 B

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