|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
I am a complete novice in Linux, so this might be a really stupid question...
I have a cron job which creates hourly backups of the database: mysqldump database_name | gzip > /var/www/backup/data.dump.gz What I would like to do, is to name the resulting files using timestamp, or some other naming convention, to keep backups unique. In other words, how can I use a variable for the filename in this situation? Thanks for your help. Kirill ![]() |
|
#2
|
|||
|
|||
|
Just add a date like so:
Code:
/var/www/backup/`date +'%B-%d-%Y'`-data.dump.gz BTW, why are you not using full path for mysqldump? |
|
#3
|
|||
|
|||
|
Thanks for your reply. However, your suggestion does not work. It gives me an error "too many non-option arguments." Do you know what I am doing wrong?
Thanks for your help. Kirill ![]() |
|
#4
|
|||
|
|||
|
Show us your revision of that line. Note, you need to quote your path.
|
|
#5
|
||||
|
||||
|
And a clarification- those are backticks, not single quotes. Backticks are on the same key as the ~
|
|
#6
|
|||
|
|||
|
Here is the complete line from the file:
mysqldump database_name | gzip > /var/www/backup/`date +'%B-%d-%Y'`-data.dump.gz If I put quotes around the path, it stops executing date command. I know I am probably missing something very simple. Can you guys help, please? Kirill ![]() |
|
#7
|
|||
|
|||
|
i expect it's just a typo or something...
here's what I have - very similar to freebsd's suggestion:
/usr/local/mysql/bin/mysqldump --add-drop-table --add-locks msgboard > /webhome/sql/msgboard`date +%y%m%d`.sql
__________________
Little more than a playground for the bugs that live beneath us... |
|
#8
|
|||
|
|||
|
I figured it out.
Thanks for the help, though! |
|
#9
|
||||
|
||||
|
cant you just use the \ for spaces and get rid of the quotes altogether?
__________________
microsofts butterfly is their way off telling u their systems have a **** load of buggs Advocating Linux Guide Lesbian Linux Great & Practical Computer Books like the links? |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > need help with naming files in cron |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|