Last active
December 26, 2015 20:39
-
-
Save relekang/7210246 to your computer and use it in GitHub Desktop.
Puppet file for generating pg_dump cron
This file contains 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
# Define: postgresql::backup | |
# | |
# Backup of a postgresql database using pgdump. | |
# Usage: postgresql::backup { [ 'db1', 'db2' ]: } | |
define postgresql::backup { | |
file{ [ '/backups', '/backups/postgres', "/backups/postgres/${title}" ]: | |
ensure => 'directory', | |
owner => 'postgres' | |
} | |
cron{ "${title}-pg-dump": | |
command => "/usr/bin/pg_dump ${title} | gzip -c -9 > /backups/postgres/${title}/`date +%Y-%m-%d`.sql.gz", | |
user => 'postgres', | |
hour => '0-23/4', | |
minute => 40, | |
require => File["/backups/postgres/${title}"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment