| |
Monday, April 13. 2009Adding date to crontab mysqldump
After mangling some crontabs commands, I finally got the date into mysql exports.
mysqldump -u database-user -h localhost -pdatabase-password database | gzip -9 > /path/to/backup/directory/database-data`date +%m%d%y`.sql.gz This command will dump the database, gzip it then add the date to the exported file. Basically if you had problems adding a date to the export file you most likely forgot to add a '\' before the %m, %d, or the %y. edit: well it looks like my blog is actually removing the \ before the %m%d%y in the command. It should look like this minus the spaces... \ %m \ %d \ %y Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
Thanks for the tip.
There's a "/" missing : /database-data`date +%m%d%y`.sql.gz ==> /database-data/`date +%m%d%y`.sql.gz And files are easier to find when the year comes first ==> /database-data/`date +%Y-%m-%d`.sql.gz
Hi,
Thanks a lot, I was breaking my head to incorporate the date in the filenames, in crontab entries. With Regards Chandra |
QuicksearchSyndicate This Blog |
