Subject: Query about "ssh" from perl program
Hello All,
I have a query about using "ssh" programmatically.
I tried using both system and exec, but didn't work. I mean, I wanted some
processing to happen on the remote machine to which i connect with "ssh",
which is not happening.
I have copied the code below.
Kindly help or suggest any other options!
Thanks!
Dhanashri
----------------------------------------------------------------------------
--------
foreach $machine (@machine_list)
{
$command = "ssh -l commonuser $machine";
system($command);
$flood_dir="/home/commonuser/flood";
# Run flood
$command="$flood_dir/flood/flood $flood_dir/round-robin.xml >
$flood_dir/flood.out";
system($command);
# Run analyze_relative script on the flood logs to generate redable
report
$command="$flood_dir/flood/examples/analyze-relative
$flood_dir/flood.out > $flood_dir/flood.report";
system($command);
}
----------------------------------------------------------------------------
--------
The following works for me...
open PLATFORMS, './platforms.lst'
or &MyDieBatch('Open failed', 82, __LINE__);
while (<PLATFORMS>) {
next if $. == 1;
chomp;
my ($platform,$oracle_ind,$unisol_ind,$oracle_ms,$ip_addr)
= split /,/;
&MyStd_Titles("scp to $platform",20);
`ssh [EMAIL PROTECTED] rm
Inbox/System_Support/MakeProjects/projects.dat`;
`scp -q accounts_4_unix.dat
[EMAIL PROTECTED]:Inbox/System_Support/MakeProjects/projects.dat`;
unlink 'temp' if -e 'temp';
`scp -q [EMAIL PROTECTED]:Inbox/System_Support/MakeProjects/projects.dat
temp`;
&MyStd_Titles("scp failed for <$platform>", 80)
unless -e 'temp';
}
hope this helps...
jwm
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>