PHP code example of tobischulz / rsync-backup-server

1. Go to this page and download the library: Download tobischulz/rsync-backup-server library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tobischulz / rsync-backup-server example snippets


'disks' => [

    //...

    'my_backup_disk' => [
        'driver' => 'local',  // must be local
        'root' => '/Volumes/Share/rsync-backups',  // your own path
    ],

    //...
]

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    $schedule->command('backups:dispatch')->hourly();
}

$source = SourceServer::create([
    'name' => 'mySource',   // source name
    'host' => '123.123.123.123',    // ip of the source server
    'ssh_user' => 'forge',  // ssh user on the source server
    'ssh_private_key_path' => '~/.ssh/id_rsa',  // path to the ssh private key from backup server
    'ssh_port' => 22,   // ssh port, default 22
    'backup_hour' => 5, // this sets the schedule for 5am UTC
    'source_path' => '~/backups/*', // folder on source to backup
    'destination_disk' => 'my_backup_disk',  // disk we created in /config/filesystems.php
    'type' => 'rsync' // set 'rsync' or 'backup'
]);

bash
php artisan vendor:publish --provider="TobiSchulz\RsyncBackupServer\RsyncBackupServerProvider"