Skip to content

Commit

Permalink
Merge pull request #7 from ruchus/master
Browse files Browse the repository at this point in the history
new feature "rsyncPreArgs"
  • Loading branch information
jrust committed Feb 3, 2016
2 parents 0d103d7 + fe36372 commit c028150
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ribs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/** $Id: ribs 1625 2004-11-24 20:55:48Z jrust $ */
// {{{ version

define('RIBS_VERSION', '2.3');
define('RIBS_VERSION', '2.4');

// }}}
// {{{ description
Expand Down Expand Up @@ -40,7 +40,7 @@ define('RIBS_VERSION', '2.3');
*
* rsync - http://samba.anu.edu.au/rsync/
* cp & rm - http://www.gnu.org/software/fileutils/fileutils.html
* PHP - http://www.php.net/
* PHP - http://www.php.net/ PHP <= 5.4
* basic PEAR libraries (as of version 1.1) - http://pear.php.net/
*
* Use:
Expand Down Expand Up @@ -82,6 +82,8 @@ $s_destinationDir = dirname(__FILE__) . '/backups/';
* 'post_error_command' => 'Same as post_command, but run when an error occurs.'
* 'pre_command' => Execute a shell command just before start backup.
* Is useful to execute for example a mysql backup script in the remote machine.
* 'rsyncPreArgs' => Include defined params in the beginning on the rsync command.
* Useful to set the --rsync-path parameter in the remote machine.
* ),
* @type array
*/
Expand All @@ -94,6 +96,7 @@ $a_backupHosts = array(
'excludes' => '',
'limits' => array('hourly' => 24), // because this is backed up every hour
'pre_command' => '/usr/bin/ssh my_host.example.com "/usr/share/init_backup.sh"',
'rsyncPreArgs' => '--rsync-path=/usr/syno/bin/rsync',
),
'small_host' => array(
'enabled' => false,
Expand Down Expand Up @@ -260,6 +263,7 @@ set_time_limit(0);
// we want all errors
error_reporting(E_ALL);


$args = Console_Getopt::readPHPArgv();
if (PEAR::isError($args)) {
die('Fatal Error: ' . $args->getMessage() . "\n");
Expand Down Expand Up @@ -551,7 +555,14 @@ foreach ($a_configNames as $s_configName) {
}
}

$tmp_rsyncArgs = $s_rsyncArgs;

if(!empty($a_backupHosts[$s_configName]['rsyncPreArgs'])) {
$tmp_rsyncArgs = $a_backupHosts[$s_configName]['rsyncPreArgs']. ' ' .$s_rsyncArgs;
} else {
$tmp_rsyncArgs = $s_rsyncArgs;
}


if ($b_dryRun) {
$tmp_rsyncArgs .= ' -n';
}
Expand Down

0 comments on commit c028150

Please sign in to comment.