Results 1 to 8 of 8
Thread: Cron Job for Automatic Backup
-
12-26-2006, 12:34 AM #1WHT Addict
- Join Date
- Oct 2005
- Posts
- 113
Cron Job for Automatic Backup
Im currently making manuel mysql back and must say it sucks.
I need a solution where I can set a automatic cronjob command via ssh and it backup the file every 12 hours twice a day.
And it has to be compressed in .gzip format to make it handleable for regular DSL users.
Also I need a solution that sets the time on the file like backup11.41am.tar.gzip or something similar with date and time.
Can someone make a command and post here make sure you also instruct me on how to set it on SSH mode. and how I can stop the command in future if necassary.
-
12-26-2006, 10:27 AM #2WHT Addict
- Join Date
- Oct 2005
- Posts
- 113
my god all these people here and no one knows this??
-
12-26-2006, 11:55 AM #3Junior Guru Wannabe
- Join Date
- Mar 2005
- Posts
- 92
There's TONS of sample bash scripts on the net, just do a google search.
Linux/BSD Systems Administrator
-
12-26-2006, 11:59 AM #4Web Hosting Master
- Join Date
- Nov 2005
- Location
- Seattle, WA
- Posts
- 648
Either that or hire a coder
-
12-26-2006, 12:02 PM #5Disabled
- Join Date
- Oct 2005
- Posts
- 515
Get the path to your database and do something similiar to this every 12 hours, deleting the original tar file before you run it by issuing an 'rm -f'
tar cvf /var/lib/mysql/db_name /backups/db_name.tgz
-
12-26-2006, 12:23 PM #6LORD OF THE RINGS
- Join Date
- Dec 2005
- Location
- Internet
- Posts
- 1,352
1) Setup SSH keys between the 2 servers
2) create the script that has to be executed as cron. a sample code below:
tar cvf /var/lib/mysql/database /backup/databasename.tgz
scp /backup/databasename root@IP:/backup/
3) Setup the scipt as a cron job to execute every 12 hours.
Let us know how it goes.
-
12-26-2006, 01:30 PM #7WHT Addict
- Join Date
- Oct 2005
- Posts
- 113
thanks all on google
-
12-29-2006, 11:00 AM #8Web Hosting Master
- Join Date
- Nov 2004
- Location
- Australia
- Posts
- 1,737
Just write a PHP script that exports the database, and call it every few hours. It's not that hard, although getting it running robustly and well isn't trivial either.