Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Redis dump and copy every other hour. Run puppet apply redis-backup.pp to install. The copying will overwrite the last backup from the same day.
file{ [ '/backups', '/backups/redis' ]:
ensure => 'directory',
owner => 'root'
}
cron{ 'redis-bgsave':
command => 'redis-cli bgsave',
user => 'root',
hour => '0-23/2',
minute => 3,
}
cron{ 'redis-move-backup':
command => 'mv /var/lib/redis/dump.rdb /backups/redis/`date +%Y-%m-%d`.rdb',
user => 'root',
hour => '0-23/2',
minute => 23,
require => [ File['/backups/redis'], Cron['redis-bgsave'] ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment