It is very fast and easy to backup your databases with CRON JOBS....
let see what it is:
With CRON JOBS you can execute your files and commands on a specific time which you want them to be executed.
in CPanel select Cron Job icon and select advanced (Unix Style) :
The timing:
* * * * * => Execute every minute
0 * * * * => Execute every Hour
0 0 * * * => Execute every mid-night
0 0 0 * * => Execute every Month
0 0 0 0 * => Execute every Weekday
DATABASE: ( mySQLdump ) -------------------------------------
command:
date=`date -I` ; mysqldump -uDBUSER -pDBPASS DBNAME | gzip > /home/USERNAME/public_html/backups/db_$date.gz
DBUSER : your database user name
DBPASS : your database password
DBNAME : your database name
USERNAME : your hosting username
Note: it will backup your database and stores it on your backups folder on your root folder of the host. the naming of the file will form the dates.
EXECUTING FILES: -------------------------------------
run a script on your host by this code:
0 * * * * /usr/local/bin/php -q /home/USERNAME/public_html/filename.php
USERNAME : your hosting username
filename.php : your file name to be executed
Note: the timing is scheduled to run the file every hour in this example
TAKE a complete backup from your host: -------------------------------------
0 0 0 0 *
command:
date=`date -I` ; tar -zcf /home/USERNAME/public_html/backups/host_backup_$date.tgz ./public_html
USERNAME : your hosting username
Using Cron Jobs to Execute files and Backup Databases ( mysqlDump )
-
- Posts: 56
- Joined: Sat Mar 10, 2007 11:36 am
-
- Posts: 56
- Joined: Sat Mar 10, 2007 11:36 am
hey could u please tell me how to send these backups to a different server through ftp??
i know the ssh command to do that.. how will we do i it through cron?
the ssh is :
/usr/bin/perl /usr/local/cpanel/bin/ftpput /home/USERNAME/Backup_FILENAME.gz FTP_Host_NAME FTP_USERNAME ftp /home/USERNAME/ 21
that command i got when i was generating full backup using cpanel and was sending it to my another server.. i got that command from WHM(root account)'s log , but it doesnt show where to write the ftp password...thats why i need you to help me.. hope u can help.
i know the ssh command to do that.. how will we do i it through cron?
the ssh is :
/usr/bin/perl /usr/local/cpanel/bin/ftpput /home/USERNAME/Backup_FILENAME.gz FTP_Host_NAME FTP_USERNAME ftp /home/USERNAME/ 21
that command i got when i was generating full backup using cpanel and was sending it to my another server.. i got that command from WHM(root account)'s log , but it doesnt show where to write the ftp password...thats why i need you to help me.. hope u can help.
-
- Posts: 56
- Joined: Sat Mar 10, 2007 11:36 am
Well use to make the backup, then to send it, just replace the things like host name, and admin/password, and username witht he right things and it should work.
Code: Select all
date=`date -I` ; tar -zcf /home/USERNAME/public_html/backups/host_backup_$date.tgz ./public_html
Code: Select all
date=`date -I` ;/usr/bin/perl /usr/local/cpanel/bin/ftpput /home/USERNAME/backups/host_backup.tgz FTP_Host_NAME admin:password ftp /home/USERNAME/ 21
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti