Doesn't work if I have my configuration save in a .txt file.
Search for it, assign to variable and do a chomp on it.
$ws
$server /server/folder/a/b
$local /local/a/b/c
WORK:
my $cmd1 = "ssh $ws ls $server";
`$command_ssh`;
my @exec = "rsync -e ssh -avz user\@xxx.yyy.zzz.com:/server/folder/a/
b /local/a/b/c ";
print "@exec \n";
system(@exec);
DOESN'T WORK:
I think it has to do with @a in the user name & :. How can I fix this?
I have try qq, qw.
my @exec = "rsync -e ssh -avz $ws:$server $local ";
print "@exec \n";
system(@exec);
On Dec 9, 12:37*pm, Glenn Jackman <gle...@ncf.ca> wrote:
> At 2008-12-09 02:07PM, "Slickuser" wrote:
>
> > *my $workstation = "xxx\@domain.com";
> > *my $source_dir = "/aaa/bbb/ccc/ddd/"; #remote
> > *my $destination_dir = "/xxx/yyy/zzz/"; #local
>
> > *my $command1 = "rsync $source_dir $destination_dir";
> > *my $command2 = "ssh $workstation $command1";
>
> > *`$command2`;
>
> > *How can I achieve that when my $source_dir on a remote server. I want
> > *to rsync to destination which is not remote.
>
> You probably want:
>
> * * my @cmd = qw( rsync -e ssh remoteuser@remotehost:/remote/dir /local/dir );
> * * system(@cmd) == 0 or die "return value from system call: $?";
>
> --
> Glenn Jackman
> * * Write a wise saying and your name will live forever. -- Anonymous