Simple Ruby Script for folders and databases backups

Sweety Backy

Simple mechanism to configure and execute backups of folders and MySQL DBs and store them in local folder or S3 bucket.


This is a really beta version which is working in my servers actually without problems but you have to use it under your own risk.

Other possibilities

Please take a look of other Ruby backups gems:

How install

gem install 'sweety_backy'

How to use it

sweety_backy <config_file>

Config file

It is a yaml file with all this attributes

paths: <array of folder paths>
databases: <array of database names>
yearly: <quantity of yearly backups>
monthly: <quantity of monthly backups>
weekly: <quantity of weekly backups>
daily: <quantity of daily backups>
slices_size: <in MB, if present the compressed files will be sliced in pieces>
database_user: <database user with read privileges of all datases>
database_pass: <database user password>
storage_system: { 's3' | 'local' }
local_opts: (only if the storage_system is 'local')
  path: <absoulte path to the root folder of the backups>
s3_opts: (only if the storage_system is 's3')
  bucket: <bucket name>
  path: <bucket path where the backups will be stored>
  passwd_file: <path to the S3 credentials>

S3 credentials file

It is a yaml file with two keys with the S3 credentials:

access_key_id: "XXX"
secret_access_key: "YYY"


S3 config example

# ~/.s3.passwd
access_key_id: "XXX"
secret_access_key: "YYY"

SweetyBacky config example

# ~/.sweety_backy.conf
paths: [ "/Users/fguillen/Develop/Brico", "/Users/fguillen/Develop/Arduino" ]
databases: [ "test", "mysql" ]
yearly: 1
monthly: 2
weekly: 3
daily: 4
slices_size: 100
database_user: 'root'
database_pass: ''
storage_system: 's3'
  bucket: 'sweety_backy'
  path: 'fguillen'
  passwd_file: '~/.s3.passwd'


sweety_backy ~/.sweety_backy.conf


This will generate a bunch of backups in the sweety_backy bucket like these ones:

... and so on.

Cron execution example

# every day at 02:00 am
00 02 * * * sweety_backy /home/fguillen/.sweety_backy.conf >> /var/log/sweety_backy.log 2>&1

State of development

I'm using it in my prouduction servers, but it can fails and damage your data.. use it at your own risk.


MIT License. (c) 2011 Fernando Guillen (