Dhanashri Bhate
Jul 8 2005, 04:37 AM
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);
}
------------------------------------------------------------------------------------
John Moon
Jul 8 2005, 09:50 AM
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 usract@$ip_addr rm
Inbox/System_Support/MakeProjects/projects.dat`;
`scp -q accounts_4_unix.dat
usract@$ip_addr:Inbox/System_Support/MakeProjects/projects.dat`;
unlink 'temp' if -e 'temp';
`scp -q usract@$ip_addr:Inbox/System_Support/MakeProjects/projects.dat
temp`;
&MyStd_Titles("scp failed for <$platform>", 80)
unless -e 'temp';
}
hope this helps...
jwm
Nan Jiang
Jul 8 2005, 10:15 AM
Hi All,
I'm trying to add data to my mysql database, however, I received a SQL
syntax error because sometimes my string variable contains single quotation
mark (').
Does anyone know how to cope with it?
My statement is below:
$dbh->do("INSERT INTO table1 values(id, '$_', '$t')") foreach sort keys
%temp;
Many many thanks!
Nan
Ing. Branislav Gerzo
Jul 8 2005, 10:21 AM
Nan Jiang [NJ], on Friday, July 08, 2005 at 11:15 (+0000) has on mind:
NJ> My statement is below:
NJ> $dbh->do("INSERT INTO table1 values(id, '$_', '$t')") foreach sort keys
NJ> %temp;
you really should read guide for database statements, this is not way
how to do these things.
for example:
http://perlmonks.org/?node_id=284436http://www.perl.com/pub/a/1999/10/DBI.htmlthere are many guides and you should read them.
--
How do you protect mail on web? I use
http://www.2pu.net[Only the winners decide what were war crimes. - Gary Willis]
Dhanashri Bhate
Jul 8 2005, 10:58 AM
Hello John,
Thank you very much!
I made changes as per your inputs and it worked,
Thanks again,
Dhanashri
-> -----Original Message-----
-> From: Moon, John [mailto:[Email Removed]]
-> Sent: Friday, July 08, 2005 4:21 PM
-> To: Dhanashri Bhate; [Email Removed]
-> Subject: RE: Query about "ssh" from perl program
->
->
-> 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 usract@$ip_addr rm
-> Inbox/System_Support/MakeProjects/projects.dat`;
-> `scp -q accounts_4_unix.dat
-> usract@$ip_addr:Inbox/System_Support/MakeProjects/projects.dat`;
-> unlink 'temp' if -e 'temp';
-> `scp -q
-> usract@$ip_addr:Inbox/System_Support/MakeProjects/projects.dat
-> temp`;
-> &MyStd_Titles("scp failed for <$platform>", 80)
-> unless -e 'temp';
-> }
->
-> hope this helps...
-> jwm
->
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.