Forked from sebastianwebber/pg_cleanup_oldmorethan_30days.sh
Created
January 4, 2021 15:42
-
-
Save nim4n136/1bcf6344943f3e7abac9caa5ddca7a98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ARCHIVEDIR='/var/lib/pgsql/wal_archive' | |
LAST_BACKUP=$(ls -lto ${ARCHIVEDIR}) | |
FILE_LIST=$(pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}") | |
## TEST FIRST | |
pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}" | find -type f -mmin +30 | xargs ls -lh | |
##THEN UNCOMMENT THIS LINE | |
##pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}" | find -type f -mmin +30 -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment