PDA

View Full Version : Auto database backup


truzenzuzex
04-28-2003, 03:23 PM
Any chance of a hack to auto dump my database to a protected directory on my server?

Thanks, T

filburt1
04-28-2003, 04:25 PM
Run a cron job that does it. That's what I do and it works fine.

truzenzuzex
04-28-2003, 04:47 PM
Could you explain a little more please? :)
Kinda new to this. :)

filburt1
04-28-2003, 04:50 PM
1. Create a file like this in notepad (don't give it any extension):

#!
echo Dumping database to file...
mysqldump --opt -uusername-ppassword dbname > ~/dump.sql
echo Dump complete!

2. SSH into your host and type (where filename is whatever you named the file in step 1)

chmod +x ~/filename

3. Set the script to be a cron job. Ask your host on how to do this.

truzenzuzex
04-28-2003, 04:54 PM
Right, thanks alot mate. :)

Rapid Gaming
04-28-2003, 06:49 PM
Today at 06:50 PM filburt1 said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=388499#post388499)
1. Create a file like this in notepad (don't give it any extension):

#!
echo Dumping database to file...
mysqldump --opt -uusername-ppassword dbname > ~/dump.sql
echo Dump complete!

2. SSH into your host and type (where filename is whatever you named the file in step 1)

chmod +x ~/filename

3. Set the script to be a cron job. Ask your host on how to do this.

Is that CHMOD 0777 and can we make it automatically generate a name such as dump015215252.sql, etc

Thanks!

filburt1
04-28-2003, 06:54 PM
No, it's not chmod 777. I don't know how to rename the file like that. chmod +x makes it executable.

Rapid Gaming
04-28-2003, 06:56 PM
Yes 0777 and 777 are the same (at least, i think) -- How often do you backup your database if you don't mind me asking pls?