executing unix command on a diff domain

S

Slickuser

$command = "ssh (e-mail address removed)";
system($command);

$command2 = "ls /user/serv2/";
system($command2);

How do I get command 2 to work. I can get $command to work fine. thx
 
T

Teo

$command = "ssh (e-mail address removed)";
system($command);

$command2 = "ls /user/serv2/";
system($command2);

How do I get command 2 to work. I can get $command to work fine. thx

Hi,

if you want $command2 to be executed on the remote host you have to
send it as an argument of ssh:

my $command = 'ssh (e-mail address removed) "ls /usr/serv2/"';
system $command;


Matteo
 
S

Slickuser

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.
 
S

Slickuser

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 (e-mail address removed)
$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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top