RE: perl script on remote server linux
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/
How to run cgi script
Hi, I have installed IIS on my machine (to make my machine web server). Now i need to execute / run cgi script on my machine. cgi script is saved in c:\irfan. now how should i run this cgi script in web browser. which webURL i should give. Regards Irfan.
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/
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/
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/
RE: perl script on remote server linux
Hi, In my case, the user with which I am executing the script is not there in sudoers file. So I did in the following manner. #!/usr/bin/perl open FILE, server_list or die $!; while(FILE) { print the host is: $_; chomp; system ssh [EMAIL PROTECTED] /home/cgadgil/avm2.1/launchtomcat.sh; } close FILE; if($?){ print error \n; exit 1;} else { print success\n;} But it says : [EMAIL PROTECTED] test]$ perl ssh_test1.pl the host is: 172.21.58.149 ssh: cgadgil: Name or service not known Error Any help Regards Irf -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2008 10:38 AM To: Jeff Pang Cc: Perl Beginners [Beginners Perl] Subject: Re:perl script on remote server linux Thanks a ton Jeff. It works. Thanks, harsha Jeff Pang [EMAIL PROTECTED] 08/27/2008 12:52 AM Please respond to Jeff Pang [EMAIL PROTECTED] From Jeff Pang [EMAIL PROTECTED] To Perl Beginners [Beginners Perl] beginners@perl.org cc Subject Re:perl script on remote server linux Try the code below, wish it works fine for you. open FILE, server_list.txt or die $!; while(FILE) { print the host is: $_; chomp; system ssh -x -t $_ \sudo /home/tadipah/test.sh\ ; } close FILE; --Jeff Message du 27/08/08 06:33 De : [EMAIL PROTECTED] A : beginners@perl.org Copie à : Objet : perl script on remote server linux I am trying to execute a perl script from source A to invoke another script on 5 remote servers. The script is as follows: #!/usr/bin/perl open file, server_list.txt; @content = ; $tot=$#content+1; print $tot \n; while ($tot 0) { $m = shift @content; print $m \n; `ssh -x -t $m sudo /home/tadipah/test.sh` ; sleep 5; exit } Server_list above has the list of servers the script needs to be executed on. Above script works fine until it connects to the server and asks me the password. After I type the password, the putty sessions freezes. When I use the line below alone without the while or foreach loop, it works absolutely fine and returns me the output of the script test.sh from remote computer. `ssh -x -t SERVERNAME sudo /home/tadipah/test.sh` ; Any help is appreciated. 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/
RE: perl script on remote server linux
Thanks Jeff. It really helped. Just one doubt, if we can perform operation with ssh then why we require Net::SSH module?? Regards Irf. -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/
NET ssh module
Hi All, I am trying to install Net-ssh module. I am getting error like not able to access FTP site to fetch CPAN files. Please find the attached log. The box where i want to install this module does not have the internet connection. Please sugget. Regards Irf. [EMAIL PROTECTED] Net-SSH-Perl-1.30]# perl -MCPAN -e 'install Net::SSH::Perl' /usr/lib/perl5/5.8.8/CPAN/Config.pm initialized. CPAN is the world-wide archive of perl resources. It consists of about 100 sites that all replicate the same contents all around the globe. Many countries have at least one CPAN site already. The resources found on CPAN are easily accessible with the CPAN.pm module. If you want to use CPAN.pm, you have to configure it properly. If you do not want to enter a dialog now, you can answer 'no' to this question and I'll try to autoconfigure. (Note: you can revisit this dialog anytime later by typing 'o conf init' at the cpan prompt.) Are you ready for manual configuration? [yes] The following questions are intended to help you with the configuration. The CPAN module needs a directory of its own to cache important index files and maybe keep a temporary mirror of CPAN files. This may be a site-wide directory or a personal directory. First of all, I'd like to create this directory. Where? CPAN build and cache directory? [/root/.cpan] If you want, I can keep the source files after a build in the cpan home directory. If you choose so then future builds will take the files from there. If you don't want to keep them, answer 0 to the next question. How big should the disk cache be for keeping the build directories with all the intermediate files? Cache size for build directory (in MB)? [10] By default, each time the CPAN module is started, cache scanning is performed to keep the cache size in sync. To prevent from this, disable the cache scanning with 'never'. Perform cache scanning (atstart or never)? [atstart] To considerably speed up the initial CPAN shell startup, it is possible to use Storable to create a cache of metadata. If Storable is not available, the normal index mechanism will be used. Cache metadata (yes/no)? [yes] The next option deals with the charset your terminal supports. In general CPAN is English speaking territory, thus the charset does not matter much, but some of the aliens out there who upload their software to CPAN bear names that are outside the ASCII range. If your terminal supports UTF-8, you say no to the next question, if it supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it supports neither nor, your answer does not matter, you will not be able to read the names of some authors anyway. If you answer no, names will be output in UTF-8. Your terminal expects ISO-8859-1 (yes/no)? [yes] If you have one of the readline packages (Term::ReadLine::Perl, Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN shell will have history support. The next two questions deal with the filename of the history file and with its size. If you do not want to set this variable, please hit SPACE RETURN to the following question. File to save your history? [/root/.cpan/histfile] Number of lines to save? [100] The CPAN module can detect when a module that which you are trying to build depends on prerequisites. If this happens, it can build the prerequisites for you automatically ('follow'), ask you for confirmation ('ask'), or just ignore them ('ignore'). Please set your policy to one of the three values. Policy on building prerequisites (follow, ask or ignore)? [ask] The CPAN module will need a few external programs to work properly. Please correct me, if I guess the wrong path for a program. Don't panic if you do not have some of them, just press ENTER for those. To disable the use of a download program, you can type a space followed by ENTER. Where is your gzip program? [/bin/gzip] Where is your tar program? [/bin/tar] Where is your unzip program? [/usr/bin/unzip] Where is your make program? [/usr/bin/make] Where is your links program? [/usr/bin/links] Where is your wget program? [/usr/bin/wget] Warning: ncftpget not found in PATH Where is your ncftpget program? [] Warning: ncftp not found in PATH Where is your ncftp program? [] Where is your ftp program? [/usr/kerberos/bin/ftp] Where is your gpg program? [/usr/bin/gpg] What is your favorite pager program? [/usr/bin/less] What is your favorite shell? [/bin/bash] Every Makefile.PL is run by perl in a separate process. Likewise we run 'make' and 'make install' in processes. If you have any parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass to the calls, please specify them here. If you don't understand this question, just press ENTER. Parameters for the 'perl Makefile.PL' command? Typical frequently used settings: PREFIX=~/perl non-root users (please see manual for more hints) Your choice: [] Parameters for the 'make' command? Typical frequently used setting: -j3
RE: doubt in code
Hi, Can somebody please help. Regards Irfan. -Original Message- From: Irfan J Sayed (isayed) Sent: Friday, August 22, 2008 11:12 AM To: 'Stewart Anderson'; beginners@perl.org Subject: RE: doubt in code Agree, but where is the file name?? $server will just store the server name right? Regards Irf -Original Message- From: Stewart Anderson [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 8:25 PM To: beginners@perl.org Cc: Stewart Anderson Subject: RE: doubt in code -Original Message- From: Irfan J Sayed (isayed) [mailto:[EMAIL PROTECTED] Sent: 21 August 2008 15:49 To: beginners@perl.org Subject: doubt in code Hi All, I have sample code like this: #!/usr/bin/perl # file: lgetr.pl # Figure 1.2: Read the first line from a remote server use IO::Socket; my $server = shift; my $fh = IO::Socket::INET-new($server); my $line = $fh; print $line; As per comment it says that, it prints the first line of a file from remote server. So my understanding is that, it will go to remote server,read the file and then prints the first line of a file on the existing console. is it right ?? if yes then in the code where are we giving the filename?? Please suggest. Regards Irfan. [Stewart Anderson] my $fh = IO::Socket::INET-new($server); is where the file handle $fh gets assigned Information in this email including any attachments may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and are used under licence. British Sky Broadcasting Limited (Registration No. 2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) are direct or indirect subsidiaries of British Sky Broadcasting Group plc (Registration No. 2247735). All of the companies mentioned in this paragraph are incorporated in England and Wales and share the same registered office at Grant Way, Isleworth, Middlesex TW7 5QD. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
doubt in code
Hi All, I have sample code like this: #!/usr/bin/perl # file: lgetr.pl # Figure 1.2: Read the first line from a remote server use IO::Socket; my $server = shift; my $fh = IO::Socket::INET-new($server); my $line = $fh; print $line; As per comment it says that, it prints the first line of a file from remote server. So my understanding is that, it will go to remote server,read the file and then prints the first line of a file on the existing console. is it right ?? if yes then in the code where are we giving the filename?? Please suggest. Regards Irfan.
RE: doubt in code
Agree, but where is the file name?? $server will just store the server name right? Regards Irf -Original Message- From: Stewart Anderson [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 8:25 PM To: beginners@perl.org Cc: Stewart Anderson Subject: RE: doubt in code -Original Message- From: Irfan J Sayed (isayed) [mailto:[EMAIL PROTECTED] Sent: 21 August 2008 15:49 To: beginners@perl.org Subject: doubt in code Hi All, I have sample code like this: #!/usr/bin/perl # file: lgetr.pl # Figure 1.2: Read the first line from a remote server use IO::Socket; my $server = shift; my $fh = IO::Socket::INET-new($server); my $line = $fh; print $line; As per comment it says that, it prints the first line of a file from remote server. So my understanding is that, it will go to remote server,read the file and then prints the first line of a file on the existing console. is it right ?? if yes then in the code where are we giving the filename?? Please suggest. Regards Irfan. [Stewart Anderson] my $fh = IO::Socket::INET-new($server); is where the file handle $fh gets assigned Information in this email including any attachments may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and are used under licence. British Sky Broadcasting Limited (Registration No. 2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) are direct or indirect subsidiaries of British Sky Broadcasting Group plc (Registration No. 2247735). All of the companies mentioned in this paragraph are incorporated in England and Wales and share the same registered office at Grant Way, Isleworth, Middlesex TW7 5QD. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
doubt
Hi All, Can you please tell me what is the value of $file. When i execute this script . it says Can't open : No such file or directory Please suggect. Regards Irf. #!/usr/bin/perl # file: count_lines.pl # Figure 1.4: Count the lines of a file use strict; use IO::File; my $file = shift; my $counter = 0; my $fh = IO::File-new($file) or die Can't open $file: $!\n; while ( defined (my $line = $fh-getline) ) { $counter++; } STDOUT-print(Counted $counter lines\n);
RE: doubt
Do I need to really give the full pathname of the file and store in the $file. What does this line means my $file = shift; Regards Irf. -Original Message- From: Andrew Curry [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2008 7:06 PM To: Irfan J Sayed (isayed); beginners@perl.org Subject: RE: doubt Im going with empty string or null. -Original Message- From: Irfan J Sayed (isayed) [mailto:[EMAIL PROTECTED] Sent: 20 August 2008 14:34 To: beginners@perl.org Subject: doubt Hi All, Can you please tell me what is the value of $file. When i execute this script . it says Can't open : No such file or directory Please suggect. Regards Irf. #!/usr/bin/perl # file: count_lines.pl # Figure 1.4: Count the lines of a file use strict; use IO::File; my $file = shift; my $counter = 0; my $fh = IO::File-new($file) or die Can't open $file: $!\n; while ( defined (my $line = $fh-getline) ) { $counter++; } STDOUT-print(Counted $counter lines\n); This e-mail is from the PA Group. For more information, see www.thepagroup.com. This e-mail may contain confidential information. Only the addressee is permitted to read, copy, distribute or otherwise use this email or any attachments. If you have received it in error, please contact the sender immediately. Any opinion expressed in this e-mail is personal to the sender and may not reflect the opinion of the PA Group. Any e-mail reply to this address may be subject to interception or monitoring for operational reasons or for lawful business practices. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: doubt
Thank you very much. Really helped. Regards Irfan. -Original Message- From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2008 7:35 PM To: Irfan J Sayed (isayed) Cc: beginners@perl.org Subject: Re: doubt On Wed, 2008-08-20 at 19:03 +0530, Irfan J Sayed (isayed) wrote: Hi All, Can you please tell me what is the value of $file. When i execute this script . it says Can't open : No such file or directory Please suggect. Regards Irf. #!/usr/bin/perl # file: count_lines.pl # Figure 1.4: Count the lines of a file use strict; use IO::File; my $file = shift; This is a shortcut for: my $file = shift @ARGV; $file is assign the first command-line argument. When you run the script try placing the name of a file after it: perl count_lines.pl some_file.txt -- Just my 0.0002 million dollars worth, Shawn Where there's duct tape, there's hope. Perl is the duct tape of the Internet. Hassan Schroeder, Sun's first webmaster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Execute the Linux command on remote machine
Hi, I have downloaded the Math::Pari module and was trying to install but stuck at one palce.following is the actual operation what I did: I donloaded the Math module in /tmp dir. Please have a look below. [EMAIL PROTECTED] Math-Pari-2.010800]$ pwd /tmp/Math-Pari-2.010800 [EMAIL PROTECTED] Math-Pari-2.010800]$ ls Changes INSTALL Makefile.PL META.yml Pari.pm patches t TODO utils func_codes.h libPARI MANIFEST PariInit.pm Pari.xs README test_eng typemap [EMAIL PROTECTED] Math-Pari-2.010800]$ perl Makefile.PL Did not find GP/PARI build directory around. Do you want to me to fetch GP/PARI automatically? (If you do not, you will need to fetch it manually, and/or direct me to the directory with GP/PARI source via the command-line option paridir=/dir) Make sure you have a large scrollback buffer to see the messages, or `tee' the STDOUT/STDERR to a file. Fetch? (y/n, press Enter) n Well, as you wish... Rerun Makefile.PL when you fetched GP/PARI archive manually to the current directory, or a (grand)parent directory of it. [Keep in mind that version of Math::Pari module corresponds to the last versions of GP/PARI it was tested with.] Alternatively, you may specify pari_tgz=PATH_TO_TAR_GZ option to Makefile.PL. (There is no need to extract the archive, or build GP/PARI; but if you have it extracted [and patched, if needed], you may specify paridir=PATH_TO_DIST_DIR option to Makefile.PL) Could not find GP/PARI build directory, please run Makefile.PL with paridir=/directory option. Please suggest on how should I install this module. Regards Irfan. -Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2008 2:02 PM To: beginners@perl.org Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) schreef: Now I have installed entire Net::SSH::Perl module in the /tmp folder. It looks like you copied in stead of installed. http://www.cpan.org/misc/cpan-faq.html#How_install_Perl_modules -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Execute the Linux command on remote machine
Hi, Please find the attached log. Please please suggest. Now it is asking to enter the CPAN site. Regards Irfan. -Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2008 2:03 PM To: beginners@perl.org Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) schreef: I have downloaded the Math::Pari module and was trying to install but stuck Let's go back to the start. 1. Show us the output of `perl -V`. 2. Run perl -MCPAN -e 'install Math::Pari'. -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 [EMAIL PROTECTED] tmp]$ perl -v\par \par This is perl, v5.8.8 built for i386-linux-thread-multi\par \par Copyright 1987-2006, Larry Wall\par \par Perl may be copied only under the terms of either the Artistic License or the\par GNU General Public License, which may be found in the Perl 5 source kit.\par \par Complete documentation for Perl, including FAQ lists, should be found on\par this system using man perl or perldoc perl. If you have access to the\par Internet, point your browser at http://www.perl.org/, the Perl Home Page.\par \par [EMAIL PROTECTED] tmp]$ perl -MCPAN -e 'install Math::Pari'\par We have to reconfigure CPAN.pm due to following uninitialized parameters:\par \par cpan_home, keep_source_where, build_dir, build_cache, scan_cache, index_expire, gzip, tar, unzip, make, pager, makepl_arg, make_arg, make_install_arg, urllist, inhibit_startup_message, ftp_proxy, http_proxy, no_proxy, prerequisites_policy, cache_metadata\par \par /home/cgadgil/.cpan/CPAN/MyConfig.pm initialized.\par \par \par CPAN is the world-wide archive of perl resources. It consists of about\par 100 sites that all replicate the same contents all around the globe.\par Many countries have at least one CPAN site already. The resources\par found on CPAN are easily accessible with the CPAN.pm module. If you\par want to use CPAN.pm, you have to configure it properly.\par \par If you do not want to enter a dialog now, you can answer 'no' to this\par question and I'll try to autoconfigure. (Note: you can revisit this\par dialog anytime later by typing 'o conf init' at the cpan prompt.)\par \par Are you ready for manual configuration? [yes]\par \par \par The following questions are intended to help you with the\par configuration. The CPAN module needs a directory of its own to cache\par important index files and maybe keep a temporary mirror of CPAN files.\par This may be a site-wide directory or a personal directory.\par \par \par \par I see you already have a directory\par /home/cgadgil/.cpan\par Shall we use it as the general CPAN build and cache directory?\par \par CPAN build and cache directory? [/home/cgadgil/.cpan]\par \par \par If you want, I can keep the source files after a build in the cpan\par home directory. If you choose so then future builds will take the\par files from there. If you don't want to keep them, answer 0 to the\par next question.\par \par \par \par How big should the disk cache be for keeping the build directories\par with all the intermediate files?\par \par Cache size for build directory (in MB)? [10]\par \par \par By default, each time the CPAN module is started, cache scanning\par is performed to keep the cache size in sync. To prevent from this,\par disable the cache scanning with 'never'.\par \par Perform cache scanning (atstart or never)? [atstart]\par \par \par To considerably speed up the initial CPAN shell startup, it is\par possible to use Storable to create a cache of metadata. If Storable\par is not available, the normal index mechanism will be used.\par \par Cache metadata (yes/no)? [yes]\par \par \par The next option deals with the charset your terminal supports. In\par general CPAN is English speaking territory, thus the charset does not\par matter much, but some of the aliens out there who upload their\par software to CPAN bear names that are outside the ASCII range. If your\par terminal supports UTF-8, you say no to the next question, if it\par supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it\par supports neither nor, your answer does not matter, you will not be\par able to read the names of some authors anyway. If you answer no, names\par will be output in UTF-8.\par \par Your terminal expects ISO-8859-1 (yes/no)? [yes]\par \par \par If you have one of the readline packages (Term::ReadLine::Perl,\par Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN\par shell will have history support. The next two questions deal with the\par filename of the history file and with its size. If you do not want to\par set this variable, please hit SPACE RETURN to the following question.\par \par File to save your history? [/home
Remote command
Hi All, Can somebody have the sample Perl script which will fire the ls command on remote linux machine and give the exit status whether it is success or failure. OR can somebody please guide me step by step how to achieve this Please help. Regards Irf.
RE: Execute the Linux command on remote machine
Hi, Now I have installed entire Net::SSH::Perl module in the /tmp folder. The error which I was getting before now vanished. But now I am getting another error. Here it is : Can't locate Math/Pari.pm in @INC (@INC contains: /tmp /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi Do I need to again copy this module also. How long I should keep adding such modules. Please help Regards Irfan. -Original Message- From: Irfan J Sayed (isayed) Sent: Thursday, August 14, 2008 6:25 PM To: 'Rob Dixon'; Perl Beginners Subject: RE: Execute the Linux command on remote machine Thanks Rob. I have downloaded all the files and now copying to the right directory. I will let you know once done. Regards Irfan. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 6:23 PM To: Perl Beginners Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) wrote: Thanks for reply. I have Perl.pm installed in following path [EMAIL PROTECTED] scripts]$ ls -l /tmp/Net/SSH/ total 32 -rwxr--r-- 1 cgadgil cgadgil 32724 Aug 13 06:42 Perl.pm [EMAIL PROTECTED] scripts]$ And perl script I modified as follows #! /usr/bin/perl; # perl module to parse the AVMInstall.log file for errors use lib '/tmp'; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.cisco.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); And now I am getting another error as Can't locate Net/SSH/Perl/Packet.pm in @INC (@INC contains: /tmp /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi Now do I need to download Packet.pm and store in the same location? And what is the purpose of it. Please suggest. You've only installed part of Net::SSH::Perl. I've just downloaded version 1.30 and looked at it and it consists of 46 filed in 9 directories, one of them being Packet.pm as you describe. It's my guess you've just copied one file to the right place? You should go through the full installation or it's unlikely to work. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Execute the Linux command on remote machine
Thanks Rob. I have downloaded all the files and now copying to the right directory. I will let you know once done. Regards Irfan. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 6:23 PM To: Perl Beginners Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) wrote: Thanks for reply. I have Perl.pm installed in following path [EMAIL PROTECTED] scripts]$ ls -l /tmp/Net/SSH/ total 32 -rwxr--r-- 1 cgadgil cgadgil 32724 Aug 13 06:42 Perl.pm [EMAIL PROTECTED] scripts]$ And perl script I modified as follows #! /usr/bin/perl; # perl module to parse the AVMInstall.log file for errors use lib '/tmp'; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.cisco.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); And now I am getting another error as Can't locate Net/SSH/Perl/Packet.pm in @INC (@INC contains: /tmp /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi Now do I need to download Packet.pm and store in the same location? And what is the purpose of it. Please suggest. You've only installed part of Net::SSH::Perl. I've just downloaded version 1.30 and looked at it and it consists of 46 filed in 9 directories, one of them being Packet.pm as you describe. It's my guess you've just copied one file to the right place? You should go through the full installation or it's unlikely to work. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Execute the Linux command on remote machine
Hi All, I want to execute one command on remote Linux machine. Following is the perl code. #! /usr/bin/perl; # perl module to parse the Install.log file for errors use lib /tmp/; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.net.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); Actually i want to parse the log file for errors which is on the remote machine. so i want to execute some commands on remote machine. for example ls I have copied the Perl.pm in the /tmp folder but still i am getting @INC error. Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /tmp/ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi Please suggest. Regards Irfan.
RE: Execute the Linux command on remote machine
Still the error is same. Following is the code #! /usr/bin/perl; # perl module to parse the AVMInstall.log file for errors use lib /home/cgadgil/usr/net/ssh/perl; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.cisco.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); Please help. Regards Irfan. -Original Message- From: Sandeep Kumar [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 3:27 PM To: Irfan J Sayed (isayed) Cc: beginners@perl.org Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) wrote: Hi All, I want to execute one command on remote Linux machine. Following is the perl code. #! /usr/bin/perl; # perl module to parse the Install.log file for errors use lib /tmp/; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.net.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); Actually i want to parse the log file for errors which is on the remote machine. so i want to execute some commands on remote machine. for example ls I have copied the Perl.pm in the /tmp folder but still i am getting @INC error. Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /tmp/ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi Please suggest. Regards Irfan. you can better make a ~/usr , and copy the package there and use lib /home_dir/usr/net/ssh/perl, you cannot have use lib ~/net/ssh/perl, this does not work(for me, it didn't). sandeep. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Execute the Linux command on remote machine
hi, but I have mentioned the absolute path then perl interpreter should take the Perl.pm from /home/cgadgil/usr/net/ssh/perl it's very difficult for me to change the makefile as this is not under my control. i can change only this script. Please suggest Regards Irfan. From: Sandeep Kumar [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 5:39 PM To: Irfan J Sayed (isayed) Cc: beginners@perl.org Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) wrote: Still the error is same. Following is the code #! /usr/bin/perl; # perl module to parse the AVMInstall.log file for errors use lib /home/cgadgil/usr/net/ssh/perl; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.cisco.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); Please help. Regards Irfan. -Original Message- From: Sandeep Kumar [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 3:27 PM To: Irfan J Sayed (isayed) Cc: beginners@perl.org Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) wrote: Hi All, I want to execute one command on remote Linux machine. Following is the perl code. #! /usr/bin/perl; # perl module to parse the Install.log file for errors use lib /tmp/; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.net.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); Actually i want to parse the log file for errors which is on the remote machine. so i want to execute some commands on remote machine. for example ls I have copied the Perl.pm in the /tmp folder but still i am getting @INC error. Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /tmp/ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi Please suggest. Regards Irfan. you can better make a ~/usr , and copy the package there and use lib /home_dir/usr/net/ssh/perl, you cannot have use lib ~/net/ssh/perl, this does not work(for me, it didn't). sandeep. what i meant was you can change the Make file for the package to copy the libraries in ~/usr/lib, then you can use use lib /home/cgadgil/usr/lib/perl5/site_perl/5.8.0; it basically is just looking for a absolute path to the Net folder in lib path. sandeep.
RE: Execute the Linux command on remote machine
Hi All, Thanks for reply. I have Perl.pm installed in following path [EMAIL PROTECTED] scripts]$ ls -l /tmp/Net/SSH/ total 32 -rwxr--r-- 1 cgadgil cgadgil 32724 Aug 13 06:42 Perl.pm [EMAIL PROTECTED] scripts]$ And perl script I modified as follows #! /usr/bin/perl; # perl module to parse the AVMInstall.log file for errors use lib '/tmp'; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.cisco.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); And now I am getting another error as Can't locate Net/SSH/Perl/Packet.pm in @INC (@INC contains: /tmp /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi Now do I need to download Packet.pm and store in the same location? And what is the purpose of it. Please suggest. Regards Irfan. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 6:36 PM To: Perl Beginners Cc: Irfan J Sayed (isayed) Subject: Re: Execute the Linux command on remote machine Irfan J Sayed (isayed) wrote: I want to execute one command on remote Linux machine. Following is the perl code. #! /usr/bin/perl; # perl module to parse the Install.log file for errors use lib /tmp/; use Net::SSH::Perl; my $ssh = Net::SSH::Perl-new(avm-qa-cam2.net.com); $ssh-login(cgadgil, cgadgil); my($stdout, $stderr, $exit) = $ssh-cmd(ls); Actually i want to parse the log file for errors which is on the remote machine. so i want to execute some commands on remote machine. for example ls I have copied the Perl.pm in the /tmp folder but still i am getting @INC error. Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /tmp/ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi You are getting a lot of similar advice but it doesn't seem to be getting you anywhere. Do this. Make sure your library file Perl.pm is installed here /tmp/Net/SSH/Perl.pm then you can write use lib '/tmp'; use Net::SSH::Perl; Although as Tom said it would be nicer to install it in your home directory - something like /home/isayed/lib/Net/SSH/Perl.pm in which case you would say use lib '/home/isayed/lib'; use Net::SSH::Perl; You should be able to get one of these going at least. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/