Try this:

system "ssh -x -t SERVER_NAME \"sudo /home/irfan.sh/test.sh\" > 
/home/irfan/out.txt ";

On the desination server, create a file test.sh and add:
 #!/bin/bash 
grep "error" file_name;

The required output will be in /home/irfan/out.txt on server where you run 
the script.

Thanks,
Hary




"Irfan J Sayed (isayed)" <[EMAIL PROTECTED]>
 




08/28/2008 10:29 AM

From
"Irfan J Sayed (isayed)" <[EMAIL PROTECTED]>
To
<[EMAIL PROTECTED]>, "Jeff Pang" <[EMAIL PROTECTED]>, 
<beginners@perl.org>
cc

Subject
RE: perl script on remote server linux






Yes. I want to parse string "error" in the log file.
 
Please suggest how should I achieve this.
 
Regards
Irfan.
 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 28, 2008 7:29 PM
To: Irfan J Sayed (isayed)
Cc: beginners@perl.org; Jeff Pang
Subject: RE: perl script on remote server linux


Is there a specific text that you want to parse throught the log file? 

Thanks, 
Harsha 


"Irfan J Sayed (isayed)" <[EMAIL PROTECTED]> 
  




08/28/2008 09:29 AM 

From
"Irfan J Sayed (isayed)" <[EMAIL PROTECTED]> 
To
"Jeff Pang" <[EMAIL PROTECTED]>, <beginners@perl.org> 
cc

Subject
RE: perl script on remote server linux









Hi All,

Now what I need to do is, on remote server I need to open a file and parse 
that file for errors.
To do this I did in following way (part of perl code).

sub conn()
{
system "ssh [EMAIL PROTECTED] \"open FILE, /home/cgadgil/AVMInstall.log\" or 
die $!;";
if ($?){ print "connection failed\n";} else{ print "connection 
successful\n";}
}

But I am getting error as follows.
Couldnt get a file descriptor referring to the console
connection failed

Please suggest.

Regards
Irfan.



-----Original Message-----
From: Jeff Pang [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 27, 2008 2:32 PM
To: Irfan J Sayed (isayed)
Cc: beginners@perl.org
Subject: RE: perl script on remote server linux

> system "ssh [EMAIL PROTECTED] /home/cgadgil/avm2.1/launchtomcat.sh";

you need a "\" before the "@".
modify it to:

system "ssh [EMAIL PROTECTED] /home/cgadgil/avm2.1/launchtomcat.sh";

Créez votre adresse électronique [EMAIL PROTECTED]
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



Reply via email to