how to backup a database, 2
after discussing my "rotation" method for backing up these mysql databases with someone, a new approach was suggested which i believe makes a little more sense.
currently, the backup script "moves" ("overwrites","copies",whatever you want to call it- i'm not sure exactly how the linux "mv" command works...) 4 files and creates one new one. also, the name of the file does not indicate when it was created.
the new script first creates a new backup file, the extension of which is YYYYMMDD, example: "recipes.sql.20080403". get the date with:
d=`date '+%Y%m%d'`
second, the backup files that are older than 3 days are removed. this last command may look something like this (say the database is called "recipes"):
find ../backups/ -type f -mtime +3 | | grep recipes | awk '{print "rm " $1}' | sh
currently, the backup script "moves" ("overwrites","copies",whatever you want to call it- i'm not sure exactly how the linux "mv" command works...) 4 files and creates one new one. also, the name of the file does not indicate when it was created.
the new script first creates a new backup file, the extension of which is YYYYMMDD, example: "recipes.sql.20080403". get the date with:
d=`date '+%Y%m%d'`
second, the backup files that are older than 3 days are removed. this last command may look something like this (say the database is called "recipes"):
find ../backups/ -type f -mtime +3 | | grep recipes | awk '{print "rm " $1}' | sh
1 Comments:
At 7:38 PM ,
frylime said...
this method seems to be more efficient...makes sense to me!
Post a Comment
Subscribe to Post Comments [Atom]
<< Home