What is this
- Inspired by rsnapshot (http://rsnapshot.org/), this is a php class that does both local and offsite incremental backups using rsync while using hard links to preserve disk space.
- It's far simpler then rsnapshot to setup and adds mysql backup support as well.
- A sample backup setup will look something like this.
- rsync, mysql, and mysqldump executables must be installed locally.
- PHP has to be run as a user with writable permission to the destination directory.
- If using ssh url, paswordless ssh must be setup by putting your public ssh key onto the remote server's authorized keys.
- If backing up mysql remotely, you must give the local machine mysql access.
// There are only 3 public methods, add_mysql(), set_options() and init().
// See Rsync Class for method documentation.
$rsync = new Rsync('firstname.lastname@example.org:/home/user/mydomain.com', '/home/dave/backups');
$rsync->add_mysql('mysql.mydomain.com', 'db_user', 'db_pass');
echo $result = $rsync->init();
- After you setup your first backup script, test and run the script from the cmd line.
- After initial backup is complete and you see no errors, you will need to run this script hourly.