Script to delete old backups
Review Request #136 - Created March 13, 2010 and submitted
Information | |
---|---|
Victor Rusu | |
infoarena | |
Reviewers | |
hackers | |
The script deletes old backups in such a manner as to maintain backups to every 2^x days (approximately) before the current one. It has to be run every day after the daily backup script.
Awesome :) I would change the name of the script into something like db-backup-delete though.
-
trunk/scripts/db-delete (Diff revision 2) -
Coding style: if (...) { ... } even for a single instruction.
-
trunk/scripts/db-delete (Diff revision 2) -
Delete one of the two empty lines.
-
trunk/scripts/db-delete (Diff revision 2) -
You should print something and exit if no backups are found. (If you don't an ugly error occurs)
-
trunk/scripts/db-delete (Diff revision 2) -
I suspect this is left over debug code. If not, you should explain and add this above, where you describe the parameters.
-
trunk/scripts/db-delete (Diff revision 2) -
Isn't this supposed to be == 0 ?
-
trunk/scripts/db-delete (Diff revision 2) -
Coding style: if (...) { ... } else { ... }
Review request changed
Change Summary:
In addition to the minor changes Bogdan pointed out, I did the following: - used mktime(0, 0, 0) instead of time() because the "days_between" function rounded up to an extra day if the script was run late in the day - modified the script to always store the backup from the day before (not just the one from the current day), because in case we need to restore the db, these are more likely candidates
Diff: |
Revision 3 (+106) |
---|
I'm sorry this took so long. :)
-
trunk/scripts/db-backup-delete (Diff revision 3) -
Left over debug code?
-
trunk/scripts/utilities.php (Diff revision 3) -
It's actually db-20100319.sql.gz.gpg . Add a \- after db.