Skip to content

Data and MYSQL Snapshots and incremental backups using PHP and Rsync.

Notifications You must be signed in to change notification settings

davidsalazar/rsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

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.
	daily.0
	daily.1
	hourly.0
	hourly.1
	monthly.0
	monthly.1
	weekly.1
	weekly.1

Requirements

  1. rsync, mysql, and mysqldump executables must be installed locally.
  2. PHP has to be run as a user with writable permission to the destination directory.
  3. If using ssh url, paswordless ssh must be setup by putting your public ssh key onto the remote server's authorized keys.
  4. If backing up mysql remotely, you must give the local machine mysql access.

Sample Usage

// There are only 3 public methods, add_mysql(), set_options() and init().
// See Rsync Class for method documentation.

$rsync = new Rsync('[email protected]:/home/user/mydomain.com', '/home/dave/backups');
$rsync->add_mysql('mysql.mydomain.com', 'db_user', 'db_pass');
echo $result = $rsync->init();

Installation

  1. After you setup your first backup script, test and run the script from the cmd line.
  2. After initial backup is complete and you see no errors, you will need to run this script hourly.

About

Data and MYSQL Snapshots and incremental backups using PHP and Rsync.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages