(You need the Access Key and the Secret Key from s3.)
You should see output like: Configuration saved to ‘/home/[USER]/.s3cfg’
Move the .s3cfg file to your s3 directory
Add the script just above Drupal root:
1
nano sqlbackup-s3.sh;
Add the following contents and make changes to variables where necessary:
If sendmail doesn’t send, make sure the log file has a subject line. Should be added by the script:
1
subject: S3 database backup
Run the script and make sure the db uploaded to S3.
Now we can setup a cron job.
In the CLI:
1
$ crontab -e
Add the following replacing the path to the script:
12
# Backup the database at 12am and 12pm everyday.
0 0,12 * * * /PATH/TO/DIR/ABOVE/ROOT/sqlbackup-s3.sh