|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
How to Crontab
Hi,
I want to use crontab to make daily backups of my mysql database. But, I don’t want it to overwrite the old file. How do I auto number the files I’m creating ? Backup - mysqldump database_name -u user_name -ppassword > SQL_Back_XX Where xx will increment one after another. Thanks ! Low. ![]() |
|
#2
|
|||
|
|||
|
This is really a Unix shell-scripting issue, not a database one, but one quick way to handle this would be to use dates:
mysqldump database_name -u user_name -ppassword > SQL_Back_`date +%Y_%m_%d` Note: the single quotes in this are backquotes (the top left key over the Tab). This means that the command inside the quotes is executed, and the result is returned as a string. So, your backup files would look like SQL_Back_2003_08_05 SQL_Back_2003_08_06 SQL_Back_2003_08_07 etc... You could also add minutes to this if you want several backups a day: mysqldump database_name -u user_name -ppassword > SQL_Back_`date +%Y_%m_%d_%M` There are many combinations you can do if you play with the date formatting options. Do a 'man date' for more info.
__________________
The real n-tier system: FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL Amazon wishlist -- rycamor (at) gmail.com |
|
#3
|
|||
|
|||
|
Thanks, Helped a bunch.
![]() Quote:
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > How to Crontab |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|