Backup and CronTab
Moderator: Admins
Backup and CronTab
How can I set up CPanel to automaticaly make a backup using crontab?
jprice,
Going through your CPanel access page you choose Cron jobs. Then "Standard". Then you choose how often you want to make the backup. We make weekly backups of every account, so my assumption is that you want a daily backup. Then choose what you want to back and input the command as so:
/bin/tar zcf ~/backup.tar.gz directory_to_backup directory2_to_backup file_i_want_as_well.html yet_another_directory_to_backup
This will create a backup.tar.gz file in your main directory that includes those 3 directories and the 1 html file. In your case, you probably only want:
/bin/tar zcf ~/backup.tar.gz public_html
That will backup your entire webpage to backup.tar.gz. You can then download this file through FTP. This backup.tar.gz file will be updated daily and overwrite itself. Be careful not to go over your quota by having 2 copies of everything on your webpage in your directory though. Always be sure to leave room for your backup.
-Matthew
matt@prioritycolo.com
Going through your CPanel access page you choose Cron jobs. Then "Standard". Then you choose how often you want to make the backup. We make weekly backups of every account, so my assumption is that you want a daily backup. Then choose what you want to back and input the command as so:
/bin/tar zcf ~/backup.tar.gz directory_to_backup directory2_to_backup file_i_want_as_well.html yet_another_directory_to_backup
This will create a backup.tar.gz file in your main directory that includes those 3 directories and the 1 html file. In your case, you probably only want:
/bin/tar zcf ~/backup.tar.gz public_html
That will backup your entire webpage to backup.tar.gz. You can then download this file through FTP. This backup.tar.gz file will be updated daily and overwrite itself. Be careful not to go over your quota by having 2 copies of everything on your webpage in your directory though. Always be sure to leave room for your backup.
-Matthew
matt@prioritycolo.com
Database Backup
I have a related question about backups. Do you also perform the database backups weekly and is there an option to backup daily?
The sql databases are backed up weekly along with your directories. Everything is placed together in one compressed file. We don't currently do daily backups because it puts an incredible load on the server and most customers don't have a need for a daily backup. If you want to backup your database daily that is easily accomplished with a crontab script that you can setup. The easiest way would be to set a crontab to dump your database at a given time and compress the resulting file. Then if you want to get advanced you can even set a crontab to mail that compressed file to an offsite e-mail address to ensure your database is completely safe.
Hopefully I've answered everything for you. If you have any other questions please let us know.
-Matthew
matt@prioritycolo.com
Hopefully I've answered everything for you. If you have any other questions please let us know.
-Matthew
matt@prioritycolo.com
Here are some free scripts used with crontab that I like to use.
MySQL Backups - Full Backups
Files/Directory Backup - Incremental Backups
MySQL Backups - Full Backups
Files/Directory Backup - Incremental Backups