Backup to S3 with Cron


Backup to S3 with Cron

Prerequisite of Install and configure S3CMD for Amazon S3

I prefer to use the sync method, of existing local backups.  You could write scripts to manually export the mysql databases, and to archive the file structure, but the built in cPanel backups are already managed by WHM, and contain everything needed to one-click restore.

As sample cron line looks like this:

0 0 17 * * s3cmd sync /backup/ --exclude '*' --include 'username.tar.gz' --include 'username.tar.gz' --multipart-chunk-size-mb=500 s3://bucketname/folder/

With this, you can have the s3 tool sync a folder of backups. 

You can also adjust the command to "put" instead of "sync" and it will always upload, and disregard current contents of the bucket.  You would want to create a lifecycle on the bucket itself to prevent it from filling up.

Last update:
2014-11-18 17:20
Author:
Admin
Revision:
1.1
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.