-
Notifications
You must be signed in to change notification settings - Fork 794
Harden mysqlbackup.sh script #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
omalashenko
commented
Apr 23, 2013
- mysql::backup backuprotate parameter sets the number of backups to keep, default is 30.
- Use bash in mysqlbackup.sh to get exit status of mysqldump when piped to bzip2. Unfortunately there is no easy portable way to do that.
- Only delete old backups when current backup finished successfully.
- Try hard not to delete files that we didn't create (i.e. README or other backups).
|
||
##### STOP CONFIG #################################################### | ||
PATH=/usr/bin:/usr/sbin:/bin:/sbin | ||
|
||
find $DIR -mtime +30 -exec rm -f {} \; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some folks are tight on space and it is better to delete before writing a dump that fills the filesystem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is good to have at least 1 good backup at any point in time, which means not deleting it before new backup has succeeded.
Secondly, at the moment there is non configurable default of 30 days worth of backups to keep. By introducing backuprotate parameter we give people tight on disk space some breathing space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All I am saying is to give people an option to change the default behaviour. Do not force it upon them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think generally I agree with razorsedge, this would be pretty easy to handle with a toggle option. Maybe even just something as horribly named as $delete_before_dump = false as a default and then a quick if/else in the template to determine ordering. Would you be willing to go that route?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will update pull request when ready.
Thanks for the improvements! We're almost done, but this PR needs rebasing off master so that it can be cleanly merged without conflicts. If you can fix that, I'll merge this one in for you. :) (If you're feeling brave, and feel up to updating mysql_backup_spec.rb to add the new parameter and make sure the "verify_contents()" content is still OK I'd appreciate it. If not I'll do this after I merge. We're looking to release 0.8.0 of this module tomorrow afternoon so hopefully we can get this one in on time to be released.) |
* mysql::backup backuprotate parameter sets the number of backups to keep, default is 30. * Use bash in mysqlbackup.sh to get exit status of mysqldump when piped to bzip2. Unfortunately there is no easy portable way to do that. * Only delete old backups when current backup finished successfully. * Try hard not to delete files that we didn't create (i.e. README or other backups).
$delete_before_dump controls whether old backups to be removed before creating new one.
Rebased to master. I'll have a look at the spec file later. |
I left omalashenko#1 for you which covers the spec changes. If you can merge that then I'll merge this! |
Tweak spec file to account for days of rotation.
…val_of_inappropriate_terminology (IAC-1010) - Removal of Inappropriate Terminology