The Cella backup script is a Bash based wrapper around rsync, mysqldump and pg_dump.
Using these standard tools and a simple configuration file Cella provides a practical and simple method of backup.
- Archives MySQL or PostgreSQL Databases/Servers
- Push/Pull Backup Methods
- Store Off-site in Amazon S3
- Connect to DAV, EncFS, FTP, Samba and others
Cella Installation
- rsync
- mysql or mysql-client
- postgresql or postgresql-client
- Suggested: openssh
- Optional: Samba and
FUSE + ftpfs, s3fs, davfs, etc
Cella is just a PHP script, w/o any dependencies on other frameworks. Each of the Actions that Cella can perform depends on an outside tool. For example, to do an rdiff based backup the rdiff-package must be installed.
Installation is to simply download the script to the target system and make it executable.
user@host # mkdir -p /opt/edoceo/cella/ user@host # cd /opt/edoceo/cella/ user@host # wget edoceo.com/bin/cella.sh user@host # chmod 0755 cella.sh
Download: edoceo.com/bin/cella.sh
Cella Usage
Super Easy!
Standard command format is cella.sh
[option] <script>
.
Here are some examples.
Show Help
user@host # ./cella.sh
Show the Job List
user@host # ./cella.sh show
Run the Job List
user@host # ./cella.php pack
Run the Job List - debug/dry-run mode
user@host # ./cella.php -d pack
Show Archive List!
user@host # ./cella.php list
Do a few things (like in cron)
user@host # ./cella.php pack trim list
Cella Configuration
- /etc/edoceo/cella.ini
- ~/.edoceo/cella.ini
- [directory of cella.php]/cella.ini
- [current directory]/cella.ini
Cella scans the locations above for configuration files and loads each. Later files can/will over-write the data from the previous.
The files are plain ini style configurations. Section names are the titles of the backup job. The action, source and target parameters are required for all jobs.
# Cella Example Backup File # :mode=shellscript: # Cella defines variables and functions before calling this file # This file is run just as any other shell script # # Can set almost any vars you want here # We use special ones named like $_cella_* base="/mnt/Raid/Cella/" # Run the Functions # Typically they are like $command $source $target # # rsnap local->local rsnap_backup $base "/etc/" "etc/" # rsnap remote->local rsnap_backup $base "otherhost::/etc/" "otherhost/etc/" # rsnap local->remote rsnap_backup "/etc/" "otherhost::$base" # rsnap a remote Windows computer to Here mount -t cifs -o username=foo,password=bar //winhost/share /mnt/baz rsnap_backup /mnt/baz "$base/winhost/" umount /mnt/baz # # rsync local->local rsync_backup "/etc/" "$base/etc/" # rsync remote->local rsync_backup "otherhost:/etc/" "$base/otherhost/etc/" # rsync local->remote rsync_backup "/etc/" "otherhost:$base" # # Subversion Backup svn_backup /var/svn/repos/ $base/svn/ # # PostgreSQL Localhost, All Database (".") pgsql_backup "." $base/pg.dump/ "pg_user" "pg_pass" # Local Foo Database pgsql_backup "/foo" $base/pg.dump/ "pg_user" "pg_pass" # PostgreSQL Remote->Local, All Database (".") pgsql_backup "otherhost/." $base/pg.dump/ "pg_user" "pg_pass" # PostgreSQL Remote->Local, One Database pgsql_backup "otherhost/database" $base/pg.dump/ "pg_user" "pg_pass" # Run the Next Backup as Specific System User cella_runas "postgres" pgsql_backup "." $base/pg.dump/ "pg_user" "pg_pass" # Make a Tarball targz_backup "/etc" "$base/etc.tgz" # Backup LDAP slapd_backup "....." "$base/dump.ldif" # Show Outputs After? touch $base date > $base/timestamp.chk du -sh $base
See Also
- BackupPC a slightly larger solution in PERL
- Backup Ninja - another similar project