You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(26) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(5) |
Feb
(3) |
Mar
(11) |
Apr
(10) |
May
(2) |
Jun
(5) |
Jul
(13) |
Aug
(2) |
Sep
(3) |
Oct
(10) |
Nov
(18) |
Dec
(29) |
2002 |
Jan
(12) |
Feb
(14) |
Mar
(73) |
Apr
(28) |
May
(21) |
Jun
(39) |
Jul
(40) |
Aug
(42) |
Sep
(20) |
Oct
(4) |
Nov
(9) |
Dec
(18) |
2003 |
Jan
(2) |
Feb
(8) |
Mar
(6) |
Apr
(24) |
May
(24) |
Jun
(14) |
Jul
(16) |
Aug
(36) |
Sep
(34) |
Oct
(23) |
Nov
(4) |
Dec
(15) |
2004 |
Jan
(6) |
Feb
(13) |
Mar
(7) |
Apr
(5) |
May
(11) |
Jun
(5) |
Jul
(4) |
Aug
|
Sep
(2) |
Oct
(16) |
Nov
(4) |
Dec
(9) |
2005 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
(10) |
May
(5) |
Jun
(13) |
Jul
(3) |
Aug
|
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(9) |
2006 |
Jan
|
Feb
(10) |
Mar
(22) |
Apr
(14) |
May
(5) |
Jun
(4) |
Jul
(19) |
Aug
(7) |
Sep
(16) |
Oct
(4) |
Nov
(1) |
Dec
(16) |
2007 |
Jan
(17) |
Feb
|
Mar
(35) |
Apr
(5) |
May
(20) |
Jun
(11) |
Jul
(33) |
Aug
(3) |
Sep
(2) |
Oct
(11) |
Nov
(23) |
Dec
(5) |
2008 |
Jan
(10) |
Feb
(9) |
Mar
|
Apr
(6) |
May
(8) |
Jun
(7) |
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(20) |
2009 |
Jan
(8) |
Feb
(8) |
Mar
(3) |
Apr
(8) |
May
(2) |
Jun
(11) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(7) |
Dec
(4) |
2010 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(7) |
Aug
(3) |
Sep
(7) |
Oct
(2) |
Nov
(1) |
Dec
(4) |
2011 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(2) |
Jun
|
Jul
(6) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
(30) |
Apr
(10) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(12) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-27 14:38:13
|
Savador, This change_passwd.pl script looks like what I need can you help me modify it to be a usable script? Thanks, #!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; use Expect; select STDOUT; $| = 1; select STDERR; $| = 1; @ARGV == 3 or die <<USAGE; Usage: $0 host old_password new_password USAGE my ($host, $old, $new) = @ARGV; my $timeout = 20; my $debug = 0; my $ssh = Net::OpenSSH->new($host, password => $old); my ($pty, $pid) = $ssh->open2pty("passwd") or die "open2pty failed: " . $ssh->error . "\n"; my $expect = Expect->init($pty); $expect->raw_pty(1); $debug and $expect->log_user(1); sub answer_passwd { my ($pattern, $pass) = @_; $debug and print "waiting for password prompt\n"; $expect->expect($timeout, -re => $pattern) or die "expect failed\n"; $debug and print "prompt seen\n"; $expect->send("$pass\n"); $debug and print "password sent\n"; $expect->expect($timeout, "\n") or die "bad password\n"; } answer_passwd('current.*:', $old); answer_passwd('new.*:', $new); answer_passwd('new.*:', $new); $expect->expect($timeout, "success") or die "Failed!\n"; print "password updated\n"; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 1:34 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" > <and...@us...> > To: "exp...@li..." > <exp...@li...> > Cc: > Sent: Thursday, March 26, 2015 8:08 PM > Subject: [Expectperl-discuss] expect.pm script > > Need help with trying to create a expect.pm script so that I can > change passwords on my Solaris-10 and 9 servers. I am using this > expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. Net::OpenSSH distribution contains a sample script that does exactly that: https://github.com/salva/p5-Net-OpenSSH/blob/master/sample/change_passwd.pl And then Net::OpenSSH::Parallel distribution contains a similar script that is able to change the password in a bunch of hosts in parallel: https://github.com/salva/p5-Net-OpenSSH-Parallel/blob/master/sample/parallel_passwd.pl |
From: Salvador F. <sfa...@ya...> - 2015-03-27 06:36:57
|
----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...> > To: "exp...@li..." <exp...@li...> > Cc: > Sent: Thursday, March 26, 2015 8:08 PM > Subject: [Expectperl-discuss] expect.pm script > > Need help with trying to create a expect.pm script so that I can change > passwords on my Solaris-10 and 9 servers. I am using this expect.pm script > from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. Net::OpenSSH distribution contains a sample script that does exactly that: https://github.com/salva/p5-Net-OpenSSH/blob/master/sample/change_passwd.pl And then Net::OpenSSH::Parallel distribution contains a similar script that is able to change the password in a bunch of hosts in parallel: https://github.com/salva/p5-Net-OpenSSH-Parallel/blob/master/sample/parallel_passwd.pl |
From: Matt Z. <mzagrabe@d.umn.edu> - 2015-03-26 20:47:52
|
On Thu, Mar 26, 2015 at 3:13 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > $ Closing spawn id(3). > at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 > Expect::hard_close('Expect=GLOB(0xd552470)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 > Expect::DESTROY('Expect=GLOB(0xd552470)') called at tester-b line 0 > eval {...} called at tester-b line 0 > spawn id(3) closed. > Pid 32508 of spawn id(3) terminated, Status: 0xFF00 Hi Andy, Sorry I don't have the time (or expertise) to go through your error messages - it's been ages since I've used expect and was mostly a novice when I was using it. Here is a snippet that I dredged up and verified that it ssh'ed. Please forgive the rough spots of the following code - it is many years old and I'm only posting it here as evidence that ssh'ing can be done. :) #!/usr/bin/perl use strict; use warnings; use Expect; my $debug = 0; my $TIMEOUT = 5; my $command = '/usr/bin/ssh user@host'; my $exp = Expect->spawn($command) or die "Cannot spawn $command: $!\n"; wait_for_and_send('Password:', "supersecretpassword\n", $exp); # I use the % sign in my prompt. You can change it to a $. wait_for_and_send('%', "date\n", $exp); sub wait_for_and_send { my $wait_for = shift; my $send = shift; my $exp = shift; if (&wait($wait_for, $exp)) { print "\nsending '$send'\n" if ($debug); $exp->send($send); return 1; } else { print "Did not wait.\n"; return undef; } } sub wait { my $prompt = shift; my $exp = shift; if ($exp->expect($TIMEOUT, $prompt)) { print "\nfound '$prompt'\n" if ($debug); return 1; } else { $exp->hard_close(); print STDERR "Timed out looking for prompt: '$prompt'\n"; return undef; } } -m |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-26 20:35:15
|
I have debugging set to $ssh->debug(1) also I am pointing this script to execute on a solaris 10 server. Below are my results. $ Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0xd552470)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0xd552470)') called at tester-b line 0 eval {...} called at tester-b line 0 spawn id(3) closed. Pid 32508 of spawn id(3) terminated, Status: 0xFF00 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Thursday, March 26, 2015 3:04 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script On Thu, Mar 26, 2015 at 2:12 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Need help with trying to create a expect.pm script so that I can > change passwords on my Solaris-10 and 9 servers. I am using this > expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. > > #!/usr/bin/perl > use strict; > use Expect; > > my $ssh = Expect->new('ssh user@host'); #$ssh->debug(1); > $ssh->expect(5, q{Password:}); $ssh->send("password\n"); > $ssh->expect(5, '$'); #$ssh->send("exit\n"); #$ssh->close(); > exp_continue; and what is the output? -m |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-26 20:34:53
|
$ Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0xd552470)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0xd552470)') called at tester-b line 0 eval {...} called at tester-b line 0 spawn id(3) closed. Pid 32508 of spawn id(3) terminated, Status: 0xFF00 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Thursday, March 26, 2015 3:04 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script On Thu, Mar 26, 2015 at 2:12 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Need help with trying to create a expect.pm script so that I can > change passwords on my Solaris-10 and 9 servers. I am using this > expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. > > #!/usr/bin/perl > use strict; > use Expect; > > my $ssh = Expect->new('ssh user@host'); #$ssh->debug(1); > $ssh->expect(5, q{Password:}); $ssh->send("password\n"); > $ssh->expect(5, '$'); #$ssh->send("exit\n"); #$ssh->close(); > exp_continue; and what is the output? -m |
From: Matt Z. <mzagrabe@d.umn.edu> - 2015-03-26 20:03:58
|
On Thu, Mar 26, 2015 at 2:12 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Need help with trying to create a expect.pm script so that I can change > passwords on my Solaris-10 and 9 servers. I am using this expect.pm script > from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. > > #!/usr/bin/perl > use strict; > use Expect; > > my $ssh = Expect->new('ssh user@host'); > #$ssh->debug(1); > $ssh->expect(5, q{Password:}); > $ssh->send("password\n"); > $ssh->expect(5, '$'); > #$ssh->send("exit\n"); > #$ssh->close(); > exp_continue; and what is the output? -m |
From: Matt Z. <mzagrabe@d.umn.edu> - 2015-03-26 19:50:39
|
On Thu, Mar 26, 2015 at 2:08 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Need help with trying to create a expect.pm script so that I can change > passwords on my Solaris-10 and 9 servers. I am using this expect.pm script > from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. Hi Andy, There are some examples of perl expect out on the net. Try one of those then ask followup questions. If I were you, I'd be looking at a different solution than perl expect to changing passwords on Solaris systems. Cheers! -m |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-26 19:45:24
|
Need help with trying to create a expect.pm script so that I can change passwords on my Solaris-10 and 9 servers. I am using this expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. Any examples would help. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh user@host'); #$ssh->debug(1); $ssh->expect(5, q{Password:}); $ssh->send("password\n"); $ssh->expect(5, '$'); #$ssh->send("exit\n"); #$ssh->close(); exp_continue; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-26 19:28:20
|
I agree. But this is only for temporary time. Thanks. //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Thursday, March 26, 2015 2:24 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script On Thu, Mar 26, 2015 at 2:08 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Need help with trying to create a expect.pm script so that I can > change passwords on my Solaris-10 and 9 servers. I am using this > expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. Hi Andy, There are some examples of perl expect out on the net. Try one of those then ask followup questions. If I were you, I'd be looking at a different solution than perl expect to changing passwords on Solaris systems. Cheers! -m |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-26 19:09:05
|
Need help with trying to create a expect.pm script so that I can change passwords on my Solaris-10 and 9 servers. I am using this expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. Any examples would help. //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 |
From: Gabor S. <ga...@sz...> - 2014-09-02 19:58:38
|
Hi Roland and list! I've just release 1.31 in which I've tried to fix some of the newly added test that failed randomly. As I don't really have an immediate need for Expect (just when I teach Test automation I like to tech Expect as well), so for now I think my main focus will be to clean up the test to reduce the failures. Some of the new tests fail in very strange and unexpected ways. If any of you have time it would be great if you could take a look at the tests. I added some comments explaining the issues and linking to reports. With that said, I think it would be nice to collect the thoughts from the people here and especially from you Roland, on how that future Expect2 might be designed. Even if we don't start to implement it now, I think it would be worth putting together a document. Roland, please don't spare me from your design ideas. If nothing else, I'll put them in a file in the expect.pm repository. Regarding IO::Pty, I am not sure. As I can see Todd Rinaldo has released a version in May 2014, but he has not touched it since then. I don't even know what it is supposed to do. So give me a co-maint bit and we'll see :) regards Gabor On Tue, Aug 26, 2014 at 6:11 PM, Roland Giersig <rgi...@cp...> wrote: > As the (mostly retired) maintainer and co-author of Expect I'd like to add > some thoughts and explanations: > > The non-OOP interface was the original one, crafted after the Tcl/Tk > version of Expect and designed to make the move from Tcl/Tk to Perl as > straight as possible. I did have some support requests for the non-OOP > version, so people did use it but I have no idea how large demand for that > is nowadays. > > Still, some people might use it so I would vote for leaving it in Expect, > patching only the most pressing bugs and move the OOP version to Expect2 to > become the official version that gets full improvement support. Maintenance > for Expect should be kept at a minimum, only fixing real urgent bugs and > checking that it runs under new versions of Perl. All enhancement requests > should be directed to Expect2. > > I have some design ideas how the Expect engine should look internally (it > is a mess now) but never had time to implement that. Should anyone want to > take a shot at that, please contact me. > > Gabor, thanks for taking over and investing your time! > BTW, most problems that crop up as Expect support requests are related to > some pseudoterminal stuff in IO::Pty, so if you want to also take that > over, Gabor... :-) > > Best regards, Roland > > > > 2014-08-25 11:43 GMT+02:00 Gabor Szabo <ga...@sz...>: > >> Hi Salvador, >> >> thanks for your reply, I hope it is ok that I send my reply back to the >> mailing list as this is the interest of all the people who might be >> subscribed. >> >> If you are talking about the change I Implemented in 1.30, that's while >> changing backward compatibility of the code the behavior was actually >> incorrect and buggy earlier. I really hope people have not relied on that >> behavior. Maybe I could add some warnings if I notice people rely on it >> and point them to some explanation how to fix it. (Thinking aloud: have a >> flag that will indicate if the latest call to ->expect was successful or not >> and if the user calls ->after or ->match when the last expect was >> unsuccessful it will give a warning and a pointer to the explanation. >> >> If you meant the elimination of the non-OOP way, actually I have no idea >> how that could be even used today. I don't recall seeing any example with >> such code and based on the documentation and reading the source code I >> could not come up with an example so far. So I am not sure if that's even >> in use. >> That's why I was asking for help. >> >> Something like Expect2 might be a good idea, I'll give it some thought. >> >> Gabor >> >> >> On Mon, Aug 25, 2014 at 12:00 PM, Salvador Fandino <sfa...@ya...> >> wrote: >> >>> >>> >>> >>> Hi Gabor >>> >>> >________________________________ >>> >>> >>> >>> > From: Gabor Szabo <ga...@sz...> >>> >To: exp...@li... >>> >Sent: Friday, August 22, 2014 12:06 PM >>> >Subject: [Expectperl-discuss] Expect 1.30 - change in behavior >>> >>> > >>> > >>> > >>> >Hi >>> > >>> > >>> >version 1.30 is on CPAN now. It has a change in behavior correcting a >>> bug. >>> >From now on ->after and ->match will return undef if the last call to >>> ->expect has failed. >>> > >>> > >>> >(Earlier they returned the information from the last successful expect) >>> > >>> > >>> >Please check if your code still works after the upgrade! >>> > >>> > >>> > >>> > >>> >I also have a question: Do you know any code that uses the Expect module >>> >in a non OOP-way? If yes, I'd urgently need examples. Otherwise I am >>> going to >>> >remove this feature. >>> >>> >>> >>> Expect is often used by sys-admins with limited Perl skills, who only >>> program occasionally and who write ugly and weak code that is very sensible >>> to minor changes. The module has been "stable" for a long time, so, are you >>> sure it is a good idea to perform mayor changes on it and even remove >>> features? it may break lots of code. >>> >>> >>> Wouldn't it be better to fork it into another module (Expect2)? That >>> would give you the freedom to redo it to your liking, without worrying too >>> much about backward compatibility. >>> >>> Note that I don't want to discourage you in any way. I am very pleased >>> to see you working on getting it on shape! >>> >>> >> >> >> >> ------------------------------------------------------------------------------ >> Slashdot TV. >> Video for Nerds. Stuff that matters. >> http://tv.slashdot.org/ >> _______________________________________________ >> Expectperl-discuss mailing list >> Exp...@li... >> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >> >> > -- Gabor Szabo http://szabgab.com/ Perl Maven http://perlmaven.com/ Perl Weekly http://perlweekly.com/ Phone: +972-54-4624648 |
From: Gabor S. <ga...@sz...> - 2014-09-02 19:05:05
|
On Tue, Aug 26, 2014 at 5:20 PM, Bryan Bueter <br...@bu...> wrote: > Gabor, > > Hello, I am the author of rover (http://sourceforge.net/projects/rover/) a > tool that uses Expect. I have done some testing and my latest CVS code > works just fine with the new 1.30. > thanks! > > However I do have some comments: > > ExtUtils::MakeMaker 6.70 is required but the only new feature I see needed > is the TEST_REQUIRES parameter. This was introduced in 6.63. I tested > 6.64 and it builds the Makefile without issue and installs Expect > successfully. > > Using an older MakeMaker will help make this build-able on many platforms. > Some MM versions on various systems I support are: > > Ubuntu 8.04 = 6.30 > Ubuntu 12.04 = 6.57 > Ubuntu 14.04 = 6.72 > RedHat ES 5 = 6.30 > RedHat ES 6 = 6.55 > CentOS 6 = 6.55 (clone of RedHat) > AIX 5.3 = 6.30 > AIX 6.1 = 6.55 > AIX 7.1 = 6.63 > > In the next version I'll remove the version requirement from ExtUtils::MakeMaker and will add the Test::* modules to the PREREQ_PM if ExtUtils::MakeMaker is too old and does not have TEST_REQUIRES yet. > > Also when making Expect, warnings were thrown for IO::Pty v1.11 not being > installed but i was able to continue. Expect fails to load without 1.11 > however. I recommend setting PREREQ_FATAL to true in order to avoid this > behavior. > I read a bit about PREREQ_FATAL and it is not recommended. The cpan client should recognize when a prerequisite is missing and install it. I am not sure why does it not happen in your case. > > Finally, it seems that installing Expect on ubuntu somehow removed > IO::Stty? I need to test this more to validate. It did not remove it on > CentOS when i installed so this may be on my end. > > That's strange. cpan clients don't remove stuff. There was an intermediate version I released that required IO::Stty, but I have reverted that and it is not a required dependency any more. Gabor |
From: Roland G. <rgi...@cp...> - 2014-08-26 15:11:37
|
As the (mostly retired) maintainer and co-author of Expect I'd like to add some thoughts and explanations: The non-OOP interface was the original one, crafted after the Tcl/Tk version of Expect and designed to make the move from Tcl/Tk to Perl as straight as possible. I did have some support requests for the non-OOP version, so people did use it but I have no idea how large demand for that is nowadays. Still, some people might use it so I would vote for leaving it in Expect, patching only the most pressing bugs and move the OOP version to Expect2 to become the official version that gets full improvement support. Maintenance for Expect should be kept at a minimum, only fixing real urgent bugs and checking that it runs under new versions of Perl. All enhancement requests should be directed to Expect2. I have some design ideas how the Expect engine should look internally (it is a mess now) but never had time to implement that. Should anyone want to take a shot at that, please contact me. Gabor, thanks for taking over and investing your time! BTW, most problems that crop up as Expect support requests are related to some pseudoterminal stuff in IO::Pty, so if you want to also take that over, Gabor... :-) Best regards, Roland 2014-08-25 11:43 GMT+02:00 Gabor Szabo <ga...@sz...>: > Hi Salvador, > > thanks for your reply, I hope it is ok that I send my reply back to the > mailing list as this is the interest of all the people who might be > subscribed. > > If you are talking about the change I Implemented in 1.30, that's while > changing backward compatibility of the code the behavior was actually > incorrect and buggy earlier. I really hope people have not relied on that > behavior. Maybe I could add some warnings if I notice people rely on it > and point them to some explanation how to fix it. (Thinking aloud: have a > flag that will indicate if the latest call to ->expect was successful or not > and if the user calls ->after or ->match when the last expect was > unsuccessful it will give a warning and a pointer to the explanation. > > If you meant the elimination of the non-OOP way, actually I have no idea > how that could be even used today. I don't recall seeing any example with > such code and based on the documentation and reading the source code I > could not come up with an example so far. So I am not sure if that's even > in use. > That's why I was asking for help. > > Something like Expect2 might be a good idea, I'll give it some thought. > > Gabor > > > On Mon, Aug 25, 2014 at 12:00 PM, Salvador Fandino <sfa...@ya...> > wrote: > >> >> >> >> Hi Gabor >> >> >________________________________ >> >> >> >> > From: Gabor Szabo <ga...@sz...> >> >To: exp...@li... >> >Sent: Friday, August 22, 2014 12:06 PM >> >Subject: [Expectperl-discuss] Expect 1.30 - change in behavior >> >> > >> > >> > >> >Hi >> > >> > >> >version 1.30 is on CPAN now. It has a change in behavior correcting a >> bug. >> >From now on ->after and ->match will return undef if the last call to >> ->expect has failed. >> > >> > >> >(Earlier they returned the information from the last successful expect) >> > >> > >> >Please check if your code still works after the upgrade! >> > >> > >> > >> > >> >I also have a question: Do you know any code that uses the Expect module >> >in a non OOP-way? If yes, I'd urgently need examples. Otherwise I am >> going to >> >remove this feature. >> >> >> >> Expect is often used by sys-admins with limited Perl skills, who only >> program occasionally and who write ugly and weak code that is very sensible >> to minor changes. The module has been "stable" for a long time, so, are you >> sure it is a good idea to perform mayor changes on it and even remove >> features? it may break lots of code. >> >> >> Wouldn't it be better to fork it into another module (Expect2)? That >> would give you the freedom to redo it to your liking, without worrying too >> much about backward compatibility. >> >> Note that I don't want to discourage you in any way. I am very pleased to >> see you working on getting it on shape! >> >> > > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > |
From: Bryan B. <br...@bu...> - 2014-08-26 14:22:48
|
Gabor, Hello, I am the author of rover (http://sourceforge.net/projects/rover/) a tool that uses Expect. I have done some testing and my latest CVS code works just fine with the new 1.30. However I do have some comments: ExtUtils::MakeMaker 6.70 is required but the only new feature I see needed is the TEST_REQUIRES parameter. This was introduced in 6.63. I tested 6.64 and it builds the Makefile without issue and installs Expect successfully. Using an older MakeMaker will help make this build-able on many platforms. Some MM versions on various systems I support are: Ubuntu 8.04 = 6.30 Ubuntu 12.04 = 6.57 Ubuntu 14.04 = 6.72 RedHat ES 5 = 6.30 RedHat ES 6 = 6.55 CentOS 6 = 6.55 (clone of RedHat) AIX 5.3 = 6.30 AIX 6.1 = 6.55 AIX 7.1 = 6.63 Also when making Expect, warnings were thrown for IO::Pty v1.11 not being installed but i was able to continue. Expect fails to load without 1.11 however. I recommend setting PREREQ_FATAL to true in order to avoid this behavior. Finally, it seems that installing Expect on ubuntu somehow removed IO::Stty? I need to test this more to validate. It did not remove it on CentOS when i installed so this may be on my end. Thanks. Bryan Bueter http://sourceforge.net/projects/rover/ |
From: Gabor S. <ga...@sz...> - 2014-08-25 09:43:55
|
Hi Salvador, thanks for your reply, I hope it is ok that I send my reply back to the mailing list as this is the interest of all the people who might be subscribed. If you are talking about the change I Implemented in 1.30, that's while changing backward compatibility of the code the behavior was actually incorrect and buggy earlier. I really hope people have not relied on that behavior. Maybe I could add some warnings if I notice people rely on it and point them to some explanation how to fix it. (Thinking aloud: have a flag that will indicate if the latest call to ->expect was successful or not and if the user calls ->after or ->match when the last expect was unsuccessful it will give a warning and a pointer to the explanation. If you meant the elimination of the non-OOP way, actually I have no idea how that could be even used today. I don't recall seeing any example with such code and based on the documentation and reading the source code I could not come up with an example so far. So I am not sure if that's even in use. That's why I was asking for help. Something like Expect2 might be a good idea, I'll give it some thought. Gabor On Mon, Aug 25, 2014 at 12:00 PM, Salvador Fandino <sfa...@ya...> wrote: > > > > Hi Gabor > > >________________________________ > > > > > From: Gabor Szabo <ga...@sz...> > >To: exp...@li... > >Sent: Friday, August 22, 2014 12:06 PM > >Subject: [Expectperl-discuss] Expect 1.30 - change in behavior > > > > > > > >Hi > > > > > >version 1.30 is on CPAN now. It has a change in behavior correcting a bug. > >From now on ->after and ->match will return undef if the last call to > ->expect has failed. > > > > > >(Earlier they returned the information from the last successful expect) > > > > > >Please check if your code still works after the upgrade! > > > > > > > > > >I also have a question: Do you know any code that uses the Expect module > >in a non OOP-way? If yes, I'd urgently need examples. Otherwise I am > going to > >remove this feature. > > > > Expect is often used by sys-admins with limited Perl skills, who only > program occasionally and who write ugly and weak code that is very sensible > to minor changes. The module has been "stable" for a long time, so, are you > sure it is a good idea to perform mayor changes on it and even remove > features? it may break lots of code. > > > Wouldn't it be better to fork it into another module (Expect2)? That would > give you the freedom to redo it to your liking, without worrying too much > about backward compatibility. > > Note that I don't want to discourage you in any way. I am very pleased to > see you working on getting it on shape! > > |
From: Gabor S. <ga...@sz...> - 2014-08-22 10:06:46
|
Hi version 1.30 is on CPAN now. It has a change in behavior correcting a bug. >From now on ->after and ->match will return undef if the last call to ->expect has failed. (Earlier they returned the information from the last successful expect) Please check if your code still works after the upgrade! I also have a question: Do you know any code that uses the Expect module in a non OOP-way? If yes, I'd urgently need examples. Otherwise I am going to remove this feature. Gabor |
From: Gabor S. <ga...@sz...> - 2014-08-14 19:35:41
|
Hi, today I got the co-maintainer bit from Roland and uploaded version 1.29. Compared to 1.21 - the previous official release - there are a number of changes. Most of them cosmetic, though there can be some special cases when the behavior of the module has changed. Please test it ASAP and report any problems you encounter. See the Changes file for details. https://metacpan.org/release/Expect I'll try to go over the rest of the open tickets as well, but I'll need your help in writing more test-cases. Currently the module has less than 50% test-coverage. If you use Expect, I'd like to hear from you! I'd like to know in what kind of situations do you use it. regards Gabor |
From: Gabor S. <ga...@sz...> - 2014-08-04 09:07:44
|
https://metacpan.org/pod/release/SZABGAB/Expect-1.24/lib/Expect.pm mostly with some additional unit-tests. Please download it, test it, and report issues. regards Gabor |
From: Gabor S. <ga...@sz...> - 2014-08-03 05:35:32
|
Let me divert this conversation back to the mailing list where more people might be able to contribute. So if it is not a bug in Expect.pm nor in IO::Tty, then I wonder how would you deal with the situation? As I understand on OSX and on the various *BSDs bc is echoing back my input (27+3) even after I call $e->raw_pty (1); How would you write your Expect code in this situation? Oh and wouldn't that mean the documentation of Expect.pm needs to be updated to explain that raw_pty(1); does not always turn off echo-ing? regards Gabor On Wed, Jul 30, 2014 at 9:57 PM, Bruce Woodward <bru...@gm...> wrote: > > Hi Gabor, > > I went as far as downloading the source for both bc and readline. At first I thought that it was something that bc was doing but after a quick search, I couldn't find any reference to bc changing the terminal settings, but readline certainly does. As for the difference between linux and mac, I really don't know for sure. readline is part of the os on mac (/usr/lib/libreadline.dylib). Perhaps apple use different compile time options than linux? All I really had to time to look at was if this was an issue with IO:Tty > > As for going off list, it wasn't on purpose. In the future I'll have to be mindful to not just click reply. > > Cheers, > Bruce. > > > On Thu, Jul 31, 2014 at 4:49 AM, Gabor Szabo <ga...@sz...> wrote: >> >> thanks, but then the question, why do they behave differently on Linux and OSX/BSD ? >> >> Gabor >> ps. and are we off-list on purpose? >> >> >> On Wed, Jul 30, 2014 at 9:31 PM, Bruce Woodward <bru...@gm...> wrote: >>> >>> Hi Gabor, >>> >>> The bc command is using the readline library, which is turning on echo. It's not a bug in IO::Tty >>> >>> Regards, >>> Bruce. >>> > > |
From: Gabor S. <ga...@sz...> - 2014-07-27 19:18:25
|
Hi, I just tried one of my sample scripts using Expect.pm on OSX and it did not work the same way as it does on Linux. Specifically, if I understand correctly, it seems that raw_pty(1) did not turn off echo-ing my input. I added a test case to the GitHub repo: https://github.com/szabgab/expect.pm/blob/master/t/02-bc.t https://github.com/szabgab/expect.pm Is there anyone using OSX here who could check this? I am doing something wrong there? Is this a bug in IO::Tty? regards Gabor |
From: Gabor S. <ga...@sz...> - 2014-07-27 07:06:25
|
Hi, earlier today I sent an e-mail to Roland offering to start maintaining Expect.pm instead of him who seems to be busy with other stuff. As code speaks louder than words, (and he might be on vacation anyway) I took the liberty and released a new, unofficial version of Expect.pm It can be found at https://metacpan.org/release/SZABGAB/Expect-1.22 The source code was placed on GitHub: https://github.com/szabgab/expect.pm In this release there are no changes to the actual code, just to the tests and the packaging. Please test this version and provide feedback. regards Gabor -- Gabor Szabo http://szabgab.com/ Perl Maven http://perlmaven.com/ Perl Weekly http://perlweekly.com/ |
From: Roland G. <rgi...@cp...> - 2013-09-16 08:46:29
|
Try setting $Expect::Exp_Internal = 1; It will tell you what Expect is trying to match, what it is receiving at what time and actually matching. This should help you figuring out what does not work. 2013/9/16 uday <udh...@gm...> > Thanks a lot for your time and recommendations Robin... I have tried but > result is same Robin... > Please find latest code below....i have my script ready but without making > this change i cant roll it out :( .... > > Hi everyone, please share your thoughts and opinion on this > > while($i <= $#fields) { > print "\n"; > print"TERMINAL: $fields[$i]\n"; > $exp->send("$fields[$i]\r"); > #$exp->send("\r"); > $exp->expect(30,'-re','root@'); > #$read = $exp->exp_before(); > print "\n"; > $i++; > } > > > > On Mon, Sep 16, 2013 at 8:11 AM, Robin Lee Powell < > rlp...@di...> wrote: > >> You really don't need expect for this; just use an ssh key and send >> the commands like "ssh host 'cat /etc/redhat-release'". >> >> In general, you shouldn't use Expect unless you have no choice. >> >> As to your actual code, the problem is that you send a bunch of commands >> very >> fast without waiting for responses. >> >> After: >> >> > $exp->send("$fields[$i]\r"); >> >> put something like: >> >> $exp=>expect(10, "root@"); >> >> to wait for the next prompt. >> >> -Robin >> >> On Sun, Sep 15, 2013 at 09:55:19PM +0530, uday wrote: >> > *Hi perl experts,* >> > >> > *I'm pretty new to perl expect and passing commands to client server and >> > printing execution status in terminal. If you look at my output, I am >> > executing “*cat /etc/redhat-release” but actual execution happens at the >> > end of code and prints the output at the end of execution. I would like >> to >> > get actual execution of “cat /etc/redhat-release” output displayed in >> > terminal after “TERMINAL: cat /etc/redhat-release” output. Could you >> please >> > help me to fix ASAP? Highly appreciated for early reply. >> > >> > * * >> > >> > * **INPUT FILE:* >> > >> > * ** [root@server-1 ~]# cat "cs3.csv"* >> > >> > *192.18.16.19,root,conley,cat /etc/redhat-release,ls,date* >> > >> > * [root@server-1 ~]#* >> > >> > * * >> > >> > *OUTPUT:* >> > >> > [root@server-1 ~]# perl temp4.pl >> > >> > >> > >> > Testcase no:1 >> > >> > ++++++++++++++++++++++++++++ >> > >> > >> > >> > Test case details: 192.18.16.19,root,conley,cat >> /etc/redhat-release,ls,date >> > >> > Logged into 192.18.16.19 >> > >> > root@192.18.16.19's password: >> > >> > Last login: Sat Sep 14 02:31:25 2013 from server-1.lss.emc.com >> > >> > TERMINAL: cat /etc/redhat-release >> > >> > TERMINAL: ls >> > >> > TERMINAL: date >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# cat /etc/redhat-release >> > >> > Red Hat Enterprise Linux Server release 5.9 (Tikanga) >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# ls >> > >> > anaconda-ks.cfg install.log >> > test.txt >> > >> > Desktop install.log.syslog >> > >> > LINUX-5.7.1.00.00-029.RHEL5.x86_64.rpm SSL >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# date >> > >> > Sun Sep 15 04:23:42 EDT 2013 >> > >> > [root@client197 ~]# exit >> > >> > logout >> > >> > Connection to 192.18.16.19 closed. >> > >> > >> > >> > *ACTUAL CODE:* >> > >> > [root@server-1 ~]# cat /perlupdate/test/csv/temp4.pl >> > >> > #!/usr/bin/perl >> > >> > use Expect; >> > >> > use warnings; >> > >> > #use strict; >> > >> > $timestamp = getLoggingTime(); >> > >> > $l_file = "/perlupdate/test/csv/log/$timestamp.log"; >> > >> > >> > >> > # Use the open() function to create the file. >> > >> > unless(open FILE, '>' .$l_file) { >> > >> > # Die with error message >> > >> > # if we can't open it. >> > >> > die "\nUnable to create $l_file\n"; >> > >> > } >> > >> > close (FILE); >> > >> > >> > >> > my $file = "cs3.csv"; >> > >> > open(my $data, '<', $file) or die "Could not open '$file' $!\n"; >> > >> > my $lnnum = 0; >> > >> > while (my $line = <$data>) { >> > >> > $exp=new Expect; >> > >> > $exp->send("\r"); >> > >> > $lnnum++; >> > >> > print "\n"; >> > >> > print "Testcase no:$lnnum \n"; >> > >> > print "++++++++++++++++++++++++++++ \n"; >> > >> > print "\n"; >> > >> > print "Test case details: $line\n"; >> > >> > print "\n"; >> > >> > chomp $line; >> > >> > my @fields = split "," , $line; >> > >> > >> > >> > $exp-> raw_pty(1); #eliminates echo back to expect >> > >> > $exp-> log_file("$l_file"); >> > >> > $exp-> debug(0); >> > >> > $exp->spawn("ssh $fields[0] -l $fields[1]") or die "Cannot connect >> > $fields[0]: $!\n"; >> > >> > print"Logged into $fields[0]\n"; >> > >> > $exp->expect(10, "password"); >> > >> > $exp->send("$fields[2]\r"); >> > >> > $exp->expect(30, "Last"); >> > >> > $exp->send("\r"); >> > >> > $i=3; >> > >> > while($i <= $#fields) { >> > >> > print "\n"; >> > >> > print"TERMINAL: $fields[$i]\n"; >> > >> > $exp->send("\r"); >> > >> > $exp->send("$fields[$i]\r"); >> > >> > print "\n"; >> > >> > $i++; >> > >> > } >> > >> > $exp->send("exit\r"); >> > >> > #$exp->send("\r") >> > >> > $exp->soft_close(); >> > >> > } >> > >> > >> > >> > >> > >> > >> > >> > sub getLoggingTime { >> > >> > >> > >> > my >> > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); >> > >> > my $nice_timestamp = sprintf ( "%04d_%02d_%02d_%02d_%02d_%02d", >> > >> > >> $year+1900,$mon+1,$mday,$hour,$min,$sec); >> > >> > return $nice_timestamp; >> > >> > } >> > >> > >> > >> > [root@server-1 ~]# >> > >> > >> > >> > >> > >> > -- >> > Cheers >> > Udhaya.D >> >> > >> ------------------------------------------------------------------------------ >> > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! >> > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, >> SharePoint >> > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack >> includes >> > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk >> >> > _______________________________________________ >> > Expectperl-discuss mailing list >> > Exp...@li... >> > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >> >> >> -- >> http://intelligence.org/ : Our last, best hope for a fantastic future. >> .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e >> lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e >> lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni >> li'u >> > > > > -- > Cheers > Udhaya.D > > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, > SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack > includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > |
From: uday <udh...@gm...> - 2013-09-16 06:48:01
|
I agree Robin. Sending this command doest require expect. however, this is just begining...we have planned to install/uninstall/upgrades packages based on previous command execution output. so we have arrived at perl expect.... On Mon, Sep 16, 2013 at 12:10 PM, uday <udh...@gm...> wrote: > Thanks a lot for your time and recommendations Robin... I have tried but > result is same Robin... > Please find latest code below....i have my script ready but without making > this change i cant roll it out :( .... > > Hi everyone, please share your thoughts and opinion on this > > while($i <= $#fields) { > print "\n"; > print"TERMINAL: $fields[$i]\n"; > $exp->send("$fields[$i]\r"); > #$exp->send("\r"); > $exp->expect(30,'-re','root@'); > #$read = $exp->exp_before(); > print "\n"; > $i++; > } > > > > On Mon, Sep 16, 2013 at 8:11 AM, Robin Lee Powell < > rlp...@di...> wrote: > >> You really don't need expect for this; just use an ssh key and send >> the commands like "ssh host 'cat /etc/redhat-release'". >> >> In general, you shouldn't use Expect unless you have no choice. >> >> As to your actual code, the problem is that you send a bunch of commands >> very >> fast without waiting for responses. >> >> After: >> >> > $exp->send("$fields[$i]\r"); >> >> put something like: >> >> $exp=>expect(10, "root@"); >> >> to wait for the next prompt. >> >> -Robin >> >> On Sun, Sep 15, 2013 at 09:55:19PM +0530, uday wrote: >> > *Hi perl experts,* >> > >> > *I'm pretty new to perl expect and passing commands to client server and >> > printing execution status in terminal. If you look at my output, I am >> > executing “*cat /etc/redhat-release” but actual execution happens at the >> > end of code and prints the output at the end of execution. I would like >> to >> > get actual execution of “cat /etc/redhat-release” output displayed in >> > terminal after “TERMINAL: cat /etc/redhat-release” output. Could you >> please >> > help me to fix ASAP? Highly appreciated for early reply. >> > >> > * * >> > >> > * **INPUT FILE:* >> > >> > * ** [root@server-1 ~]# cat "cs3.csv"* >> > >> > *192.18.16.19,root,conley,cat /etc/redhat-release,ls,date* >> > >> > * [root@server-1 ~]#* >> > >> > * * >> > >> > *OUTPUT:* >> > >> > [root@server-1 ~]# perl temp4.pl >> > >> > >> > >> > Testcase no:1 >> > >> > ++++++++++++++++++++++++++++ >> > >> > >> > >> > Test case details: 192.18.16.19,root,conley,cat >> /etc/redhat-release,ls,date >> > >> > Logged into 192.18.16.19 >> > >> > root@192.18.16.19's password: >> > >> > Last login: Sat Sep 14 02:31:25 2013 from server-1.lss.emc.com >> > >> > TERMINAL: cat /etc/redhat-release >> > >> > TERMINAL: ls >> > >> > TERMINAL: date >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# cat /etc/redhat-release >> > >> > Red Hat Enterprise Linux Server release 5.9 (Tikanga) >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# ls >> > >> > anaconda-ks.cfg install.log >> > test.txt >> > >> > Desktop install.log.syslog >> > >> > LINUX-5.7.1.00.00-029.RHEL5.x86_64.rpm SSL >> > >> > [root@client197 ~]# >> > >> > [root@client197 ~]# date >> > >> > Sun Sep 15 04:23:42 EDT 2013 >> > >> > [root@client197 ~]# exit >> > >> > logout >> > >> > Connection to 192.18.16.19 closed. >> > >> > >> > >> > *ACTUAL CODE:* >> > >> > [root@server-1 ~]# cat /perlupdate/test/csv/temp4.pl >> > >> > #!/usr/bin/perl >> > >> > use Expect; >> > >> > use warnings; >> > >> > #use strict; >> > >> > $timestamp = getLoggingTime(); >> > >> > $l_file = "/perlupdate/test/csv/log/$timestamp.log"; >> > >> > >> > >> > # Use the open() function to create the file. >> > >> > unless(open FILE, '>' .$l_file) { >> > >> > # Die with error message >> > >> > # if we can't open it. >> > >> > die "\nUnable to create $l_file\n"; >> > >> > } >> > >> > close (FILE); >> > >> > >> > >> > my $file = "cs3.csv"; >> > >> > open(my $data, '<', $file) or die "Could not open '$file' $!\n"; >> > >> > my $lnnum = 0; >> > >> > while (my $line = <$data>) { >> > >> > $exp=new Expect; >> > >> > $exp->send("\r"); >> > >> > $lnnum++; >> > >> > print "\n"; >> > >> > print "Testcase no:$lnnum \n"; >> > >> > print "++++++++++++++++++++++++++++ \n"; >> > >> > print "\n"; >> > >> > print "Test case details: $line\n"; >> > >> > print "\n"; >> > >> > chomp $line; >> > >> > my @fields = split "," , $line; >> > >> > >> > >> > $exp-> raw_pty(1); #eliminates echo back to expect >> > >> > $exp-> log_file("$l_file"); >> > >> > $exp-> debug(0); >> > >> > $exp->spawn("ssh $fields[0] -l $fields[1]") or die "Cannot connect >> > $fields[0]: $!\n"; >> > >> > print"Logged into $fields[0]\n"; >> > >> > $exp->expect(10, "password"); >> > >> > $exp->send("$fields[2]\r"); >> > >> > $exp->expect(30, "Last"); >> > >> > $exp->send("\r"); >> > >> > $i=3; >> > >> > while($i <= $#fields) { >> > >> > print "\n"; >> > >> > print"TERMINAL: $fields[$i]\n"; >> > >> > $exp->send("\r"); >> > >> > $exp->send("$fields[$i]\r"); >> > >> > print "\n"; >> > >> > $i++; >> > >> > } >> > >> > $exp->send("exit\r"); >> > >> > #$exp->send("\r") >> > >> > $exp->soft_close(); >> > >> > } >> > >> > >> > >> > >> > >> > >> > >> > sub getLoggingTime { >> > >> > >> > >> > my >> > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); >> > >> > my $nice_timestamp = sprintf ( "%04d_%02d_%02d_%02d_%02d_%02d", >> > >> > >> $year+1900,$mon+1,$mday,$hour,$min,$sec); >> > >> > return $nice_timestamp; >> > >> > } >> > >> > >> > >> > [root@server-1 ~]# >> > >> > >> > >> > >> > >> > -- >> > Cheers >> > Udhaya.D >> >> > >> ------------------------------------------------------------------------------ >> > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! >> > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, >> SharePoint >> > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack >> includes >> > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk >> >> > _______________________________________________ >> > Expectperl-discuss mailing list >> > Exp...@li... >> > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >> >> >> -- >> http://intelligence.org/ : Our last, best hope for a fantastic future. >> .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e >> lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e >> lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni >> li'u >> > > > > -- > Cheers > Udhaya.D > -- Cheers Udhaya.D |
From: uday <udh...@gm...> - 2013-09-16 06:40:33
|
Thanks a lot for your time and recommendations Robin... I have tried but result is same Robin... Please find latest code below....i have my script ready but without making this change i cant roll it out :( .... Hi everyone, please share your thoughts and opinion on this while($i <= $#fields) { print "\n"; print"TERMINAL: $fields[$i]\n"; $exp->send("$fields[$i]\r"); #$exp->send("\r"); $exp->expect(30,'-re','root@'); #$read = $exp->exp_before(); print "\n"; $i++; } On Mon, Sep 16, 2013 at 8:11 AM, Robin Lee Powell < rlp...@di...> wrote: > You really don't need expect for this; just use an ssh key and send > the commands like "ssh host 'cat /etc/redhat-release'". > > In general, you shouldn't use Expect unless you have no choice. > > As to your actual code, the problem is that you send a bunch of commands > very > fast without waiting for responses. > > After: > > > $exp->send("$fields[$i]\r"); > > put something like: > > $exp=>expect(10, "root@"); > > to wait for the next prompt. > > -Robin > > On Sun, Sep 15, 2013 at 09:55:19PM +0530, uday wrote: > > *Hi perl experts,* > > > > *I'm pretty new to perl expect and passing commands to client server and > > printing execution status in terminal. If you look at my output, I am > > executing “*cat /etc/redhat-release” but actual execution happens at the > > end of code and prints the output at the end of execution. I would like > to > > get actual execution of “cat /etc/redhat-release” output displayed in > > terminal after “TERMINAL: cat /etc/redhat-release” output. Could you > please > > help me to fix ASAP? Highly appreciated for early reply. > > > > * * > > > > * **INPUT FILE:* > > > > * ** [root@server-1 ~]# cat "cs3.csv"* > > > > *192.18.16.19,root,conley,cat /etc/redhat-release,ls,date* > > > > * [root@server-1 ~]#* > > > > * * > > > > *OUTPUT:* > > > > [root@server-1 ~]# perl temp4.pl > > > > > > > > Testcase no:1 > > > > ++++++++++++++++++++++++++++ > > > > > > > > Test case details: 192.18.16.19,root,conley,cat > /etc/redhat-release,ls,date > > > > Logged into 192.18.16.19 > > > > root@192.18.16.19's password: > > > > Last login: Sat Sep 14 02:31:25 2013 from server-1.lss.emc.com > > > > TERMINAL: cat /etc/redhat-release > > > > TERMINAL: ls > > > > TERMINAL: date > > > > [root@client197 ~]# > > > > [root@client197 ~]# > > > > [root@client197 ~]# cat /etc/redhat-release > > > > Red Hat Enterprise Linux Server release 5.9 (Tikanga) > > > > [root@client197 ~]# > > > > [root@client197 ~]# ls > > > > anaconda-ks.cfg install.log > > test.txt > > > > Desktop install.log.syslog > > > > LINUX-5.7.1.00.00-029.RHEL5.x86_64.rpm SSL > > > > [root@client197 ~]# > > > > [root@client197 ~]# date > > > > Sun Sep 15 04:23:42 EDT 2013 > > > > [root@client197 ~]# exit > > > > logout > > > > Connection to 192.18.16.19 closed. > > > > > > > > *ACTUAL CODE:* > > > > [root@server-1 ~]# cat /perlupdate/test/csv/temp4.pl > > > > #!/usr/bin/perl > > > > use Expect; > > > > use warnings; > > > > #use strict; > > > > $timestamp = getLoggingTime(); > > > > $l_file = "/perlupdate/test/csv/log/$timestamp.log"; > > > > > > > > # Use the open() function to create the file. > > > > unless(open FILE, '>' .$l_file) { > > > > # Die with error message > > > > # if we can't open it. > > > > die "\nUnable to create $l_file\n"; > > > > } > > > > close (FILE); > > > > > > > > my $file = "cs3.csv"; > > > > open(my $data, '<', $file) or die "Could not open '$file' $!\n"; > > > > my $lnnum = 0; > > > > while (my $line = <$data>) { > > > > $exp=new Expect; > > > > $exp->send("\r"); > > > > $lnnum++; > > > > print "\n"; > > > > print "Testcase no:$lnnum \n"; > > > > print "++++++++++++++++++++++++++++ \n"; > > > > print "\n"; > > > > print "Test case details: $line\n"; > > > > print "\n"; > > > > chomp $line; > > > > my @fields = split "," , $line; > > > > > > > > $exp-> raw_pty(1); #eliminates echo back to expect > > > > $exp-> log_file("$l_file"); > > > > $exp-> debug(0); > > > > $exp->spawn("ssh $fields[0] -l $fields[1]") or die "Cannot connect > > $fields[0]: $!\n"; > > > > print"Logged into $fields[0]\n"; > > > > $exp->expect(10, "password"); > > > > $exp->send("$fields[2]\r"); > > > > $exp->expect(30, "Last"); > > > > $exp->send("\r"); > > > > $i=3; > > > > while($i <= $#fields) { > > > > print "\n"; > > > > print"TERMINAL: $fields[$i]\n"; > > > > $exp->send("\r"); > > > > $exp->send("$fields[$i]\r"); > > > > print "\n"; > > > > $i++; > > > > } > > > > $exp->send("exit\r"); > > > > #$exp->send("\r") > > > > $exp->soft_close(); > > > > } > > > > > > > > > > > > > > > > sub getLoggingTime { > > > > > > > > my > > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); > > > > my $nice_timestamp = sprintf ( "%04d_%02d_%02d_%02d_%02d_%02d", > > > > > $year+1900,$mon+1,$mday,$hour,$min,$sec); > > > > return $nice_timestamp; > > > > } > > > > > > > > [root@server-1 ~]# > > > > > > > > > > > > -- > > Cheers > > Udhaya.D > > > > ------------------------------------------------------------------------------ > > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, > SharePoint > > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack > includes > > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > > > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > > > _______________________________________________ > > Expectperl-discuss mailing list > > Exp...@li... > > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > -- > http://intelligence.org/ : Our last, best hope for a fantastic future. > .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e > lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e > lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni > li'u > -- Cheers Udhaya.D |
From: Robin L. P. <rlp...@di...> - 2013-09-16 03:07:09
|
You really don't need expect for this; just use an ssh key and send the commands like "ssh host 'cat /etc/redhat-release'". In general, you shouldn't use Expect unless you have no choice. As to your actual code, the problem is that you send a bunch of commands very fast without waiting for responses. After: > $exp->send("$fields[$i]\r"); put something like: $exp=>expect(10, "root@"); to wait for the next prompt. -Robin On Sun, Sep 15, 2013 at 09:55:19PM +0530, uday wrote: > *Hi perl experts,* > > *I'm pretty new to perl expect and passing commands to client server and > printing execution status in terminal. If you look at my output, I am > executing “*cat /etc/redhat-release” but actual execution happens at the > end of code and prints the output at the end of execution. I would like to > get actual execution of “cat /etc/redhat-release” output displayed in > terminal after “TERMINAL: cat /etc/redhat-release” output. Could you please > help me to fix ASAP? Highly appreciated for early reply. > > * * > > * **INPUT FILE:* > > * ** [root@server-1 ~]# cat "cs3.csv"* > > *192.18.16.19,root,conley,cat /etc/redhat-release,ls,date* > > * [root@server-1 ~]#* > > * * > > *OUTPUT:* > > [root@server-1 ~]# perl temp4.pl > > > > Testcase no:1 > > ++++++++++++++++++++++++++++ > > > > Test case details: 192.18.16.19,root,conley,cat /etc/redhat-release,ls,date > > Logged into 192.18.16.19 > > root@192.18.16.19's password: > > Last login: Sat Sep 14 02:31:25 2013 from server-1.lss.emc.com > > TERMINAL: cat /etc/redhat-release > > TERMINAL: ls > > TERMINAL: date > > [root@client197 ~]# > > [root@client197 ~]# > > [root@client197 ~]# cat /etc/redhat-release > > Red Hat Enterprise Linux Server release 5.9 (Tikanga) > > [root@client197 ~]# > > [root@client197 ~]# ls > > anaconda-ks.cfg install.log > test.txt > > Desktop install.log.syslog > > LINUX-5.7.1.00.00-029.RHEL5.x86_64.rpm SSL > > [root@client197 ~]# > > [root@client197 ~]# date > > Sun Sep 15 04:23:42 EDT 2013 > > [root@client197 ~]# exit > > logout > > Connection to 192.18.16.19 closed. > > > > *ACTUAL CODE:* > > [root@server-1 ~]# cat /perlupdate/test/csv/temp4.pl > > #!/usr/bin/perl > > use Expect; > > use warnings; > > #use strict; > > $timestamp = getLoggingTime(); > > $l_file = "/perlupdate/test/csv/log/$timestamp.log"; > > > > # Use the open() function to create the file. > > unless(open FILE, '>' .$l_file) { > > # Die with error message > > # if we can't open it. > > die "\nUnable to create $l_file\n"; > > } > > close (FILE); > > > > my $file = "cs3.csv"; > > open(my $data, '<', $file) or die "Could not open '$file' $!\n"; > > my $lnnum = 0; > > while (my $line = <$data>) { > > $exp=new Expect; > > $exp->send("\r"); > > $lnnum++; > > print "\n"; > > print "Testcase no:$lnnum \n"; > > print "++++++++++++++++++++++++++++ \n"; > > print "\n"; > > print "Test case details: $line\n"; > > print "\n"; > > chomp $line; > > my @fields = split "," , $line; > > > > $exp-> raw_pty(1); #eliminates echo back to expect > > $exp-> log_file("$l_file"); > > $exp-> debug(0); > > $exp->spawn("ssh $fields[0] -l $fields[1]") or die "Cannot connect > $fields[0]: $!\n"; > > print"Logged into $fields[0]\n"; > > $exp->expect(10, "password"); > > $exp->send("$fields[2]\r"); > > $exp->expect(30, "Last"); > > $exp->send("\r"); > > $i=3; > > while($i <= $#fields) { > > print "\n"; > > print"TERMINAL: $fields[$i]\n"; > > $exp->send("\r"); > > $exp->send("$fields[$i]\r"); > > print "\n"; > > $i++; > > } > > $exp->send("exit\r"); > > #$exp->send("\r") > > $exp->soft_close(); > > } > > > > > > > > sub getLoggingTime { > > > > my > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); > > my $nice_timestamp = sprintf ( "%04d_%02d_%02d_%02d_%02d_%02d", > > $year+1900,$mon+1,$mday,$hour,$min,$sec); > > return $nice_timestamp; > > } > > > > [root@server-1 ~]# > > > > > > -- > Cheers > Udhaya.D > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss -- http://intelligence.org/ : Our last, best hope for a fantastic future. .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni li'u |