Skip to content

Instantly share code, notes, and snippets.

@cayblood
Created April 27, 2012 09:49
Show Gist options
  • Save cayblood/2507939 to your computer and use it in GitHub Desktop.
Save cayblood/2507939 to your computer and use it in GitHub Desktop.
backing up something daily, weekly, monthly and yearly with logrotate
# daily backup for 7 days
"/file/to/backup.log" {
daily
copytruncate
rotate 7
compress
compresscmd /bin/bzip2
compressext .bz2
}
# weekly backup for 4 weeks
"/file/to/backup.log.7.bz2" {
weekly
missingok
rotate 4
}
# monthly backup for 12 months
"/file/to/backup.log.7.bz2.4" {
monthly
missingok
rotate 12
}
# yearly backup for 10 years
"/file/to/backup.log.7.bz2.4.12" {
yearly
missingok
rotate 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment