3manuek / Python-S3-Backup

Script for archiving CVS MySQL files to S3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python-S3-Backup

Simple Python backup script for backing up files and MySQL dumps on Amazon S3.

Requirements

This script requires boto. To install boto simply -

pip install boto

Configuration

The script requires the following configuration parameters

AWS

  • Access Key - aws_access_key
  • Secret Key - aws_secret_key
  • Bucket - aws_bucket

MySQL

  • Hostname - mysql_hostname
  • Username - mysql_username
  • Password - mysql_password
  • MySQL Dump Path - mysql_dump_path

Directories

You can backup as many directories as you like. Simply define it as a list and include the full path, e.g.

dirs = [
        '/srv/www/domain1.com',
        '/srv/www/domain2.com'
        ]

Databases

You can define the databases to be backed up the same way as the directories. Make sure your user has sufficient privilidges to access all databases, if more than one.

dbs = [
        'domain1_app',
        'domain1_blog',
        ]

Crontab

Sample cron to run backup every day at 23.00.

0 23 * * * python ~/scripts/backup.py

About

Script for archiving CVS MySQL files to S3.


Languages

Language:Python 100.0%