Hi, Please suggest. Regards, Irfan. ________________________________
From: Irfan J Sayed (isayed) Sent: Friday, August 29, 2008 1:09 PM To: '[EMAIL PROTECTED]'; Jeff Pang; beginners@perl.org Subject: RE: perl script on remote server linux Thanks. It worked but with one issue. Let say if "error" keyword is not there in the log file then the file which is being created as a part of the redirection (output file) is empty. so Perl interpreter says that " connection failed" and if suppose "error " string the log file then in the output file "error" word will come and then it says connection successful. but my query is that in both the cases (irrespective whether error word is there are not in the log file) Perl should print connection successful. Please suggest Regards Irf ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2008 8:18 PM To: Irfan J Sayed (isayed) Cc: beginners@perl.org; Jeff Pang Subject: RE: perl script on remote server linux 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/