1
0
Fork 0

Create daily Cron job for PostgreSQL cleanup

This commit is contained in:
Alex Kotov 2020-07-05 14:31:25 +05:00
parent edd1ea8246
commit 0e23bef788
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 11 additions and 0 deletions

3
files/pg_cleanup Normal file
View file

@ -0,0 +1,3 @@
#!/bin/sh -e
sudo -u postgres sh -e -c "test -d /var/lib/postgresql/backups/12/main && find /var/lib/postgresql/backups/12/main -type f -mtime +35 -exec rm {} \;"

View file

@ -16,3 +16,11 @@
mode: 'u=rwx,g=rx,o=rx'
owner: root
group: root
- name: Create daily Cron job for PostgreSQL cleanup
copy:
src: ../../files/pg_cleanup
dest: /etc/cron.daily/pg_cleanup
mode: 'u=rwx,g=rx,o=rx'
owner: root
group: root