From c87279f899fc6f48103e6c8ed0a69edb980b52af Mon Sep 17 00:00:00 2001 From: "Thomas M. Lapp" Date: Tue, 8 Mar 2016 10:29:50 -0500 Subject: [PATCH] Added -sshkey arg for automated cron runs --- syncoid | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/syncoid b/syncoid index 8f67aaa..aff729a 100755 --- a/syncoid +++ b/syncoid @@ -35,7 +35,12 @@ my $mbufferoptions = '-q -s 128k -m 16M 2>/dev/null'; my $lscmd = '/bin/ls'; # figure out if source and/or target are remote. -$sshcmd = "$sshcmd $sshcipher"; +if ( $args{'sshkey'} ) { + $sshcmd = "$sshcmd $sshcipher -i $args{'sshkey'}"; +} +else { + $sshcmd = "$sshcmd $sshcipher"; +} my ($sourcehost,$sourcefs,$sourceisroot) = getssh($rawsourcefs); my ($targethost,$targetfs,$targetisroot) = getssh($rawtargetfs); @@ -243,7 +248,7 @@ sub getargs { my %novaluearg; my %validarg; - push my @validargs, ('debug','nocommandchecks','version','monitor-version','compress','source-bwlimit','target-bwlimit','dumpsnaps','recursive','r'); + push my @validargs, ('debug','nocommandchecks','version','monitor-version','compress','source-bwlimit','target-bwlimit','dumpsnaps','recursive','r','sshkey'); foreach my $item (@validargs) { $validarg{$item} = 1; } push my @novalueargs, ('debug','nocommandchecks','version','monitor-version','dumpsnaps','recursive','r'); foreach my $item (@novalueargs) { $novaluearg{$item} = 1; }