Results 1 to 2 of 2
I'm looking to set up a crontab that backs up a database every day, but I want the date to go in the filename.
The command I'm trying to do ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-12-2006 #1Banned
- Join Date
- May 2006
- Posts
- 8
Inserting date into cron command
I'm looking to set up a crontab that backs up a database every day, but I want the date to go in the filename.
The command I'm trying to do is:I want the contents to be dumped in dump-YYYYMMDD.sql though. How would I do this?Code:mysqldump --opt -Q -uuser -ppass dbname > dump.sql
Thanks in advance!
- 08-12-2006 #2Linux Enthusiast
- Join Date
- Jun 2005
- Location
- The Hot Humid South
- Posts
- 602
Look into the "date" command. You can have it output the date whatever way you want. If I'm not mistaken, to get it the way you want you would do:
Code:`date +%Y%m%d`
"Today you are freer than ever to do what you want, provided you can pay for it!" --Bad Religion


Reply With Quote
