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: Roland G. <rgi...@cp...> - 2009-04-08 23:02:48
|
Let me guess, is it a solaris machine? :-) Yes, there are some strange pty-implementations out there. And some of them insert a space-backspace combo after a certain amount of chars. Try setting the pty to raw before spawning the command. Hope this helps, Roland James Shen (jcshen) schrieb: > Hi, expect gurus : > > I have a very weird problem here , whenever the script send out the > following command : > > "copy > workspace:cores/1207476802_SAM_Alameda-A_svc_sam_*bladeAG*_log.2965.tar.gz" > > There is always a [<space>+<\b>] inserted in the word "bladeAG" and > this cause the script failure. > > Here are the exp_internal output : > > copy > workspace:cores/1207476802_SAM_Alameda-A_svc_sam_*bladeAG*_log.2965.tar.gz > spawn id(5): Does `copy > workspace:cores/1207476802_SAM_Alameda-A_svc_sam_*bla > \bdeAG*_log.2965.tar.gz' > match: > > I tried all kinds of regular expression to remove the char but the > problem is still there : > > Appreciate for any help > > James > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: James S. (jcshen) <jc...@ci...> - 2009-04-08 21:43:06
|
Hi, expect gurus : I have a very weird problem here , whenever the script send out the following command : "copy workspace:cores/1207476802_SAM_Alameda-A_svc_sam_bladeAG_log.2965.tar.gz " There is always a [<space>+<\b>] inserted in the word "bladeAG" and this cause the script failure. Here are the exp_internal output : copy workspace:cores/1207476802_SAM_Alameda-A_svc_sam_bladeAG_log.2965.tar.gz spawn id(5): Does `copy workspace:cores/1207476802_SAM_Alameda-A_svc_sam_bla \bdeAG_log.2965.tar.gz' match: I tried all kinds of regular expression to remove the char but the problem is still there : Appreciate for any help James |
From: Ron S. <gee...@ya...> - 2009-04-02 17:39:47
|
Yes, The following was my effort in that direction, but whent the script is called, a password is required. And, that's the stumbling block for me at that point. I need help to finish it off. :) #!usr/bin perl use warnings; use strict; use Expect; my $ps_check = `ps -ef | grep someScript.sh | grep -v grep`; if ($ps_check) { print "\n'someScript.sh' is running.\n\n"; } else { print "\n'someScript.sh' is not running. An attempt wil be made to start it.\n\n"; my $pid = fork(); if (!defined $pid) { die "Could not fork: $!\n"; } elsif ($pid == 0) { exec("/path/to/someScript.sh"); my $command = Expect->spawn("sudo -u root /path/to/someScript.sh") or die "Couldn't start program: $!\n"; sleep 2; print $command "somePassword\r"; exit; } else { waitpid($pid, 0); } } Ron Smith gee...@ya... (213)300-9448 --- On Thu, 4/2/09, Roland Giersig <rgi...@cp...> wrote: > From: Roland Giersig <rgi...@cp...> > Subject: Re: [Expectperl-discuss] Almost there, but missing something > To: gee...@ya... > Cc: exp...@li... > Date: Thursday, April 2, 2009, 7:58 AM > No need to fiddle with Expect, just create a check-script on > the remote side that does the auto-start and call that with > 'ssh remote-host check-script.sh'. > > HTH, Roland > > Ron Smith wrote: > > The foolowing script is meant to ssh into another > machine, check a running script and, if it's not > running, start it. I'm stuck at > 'Expect->spawn()'. I get: DB<3> p $command > Expect=GLOB(0x9a7658c) upon debugging. I'm lost at this > point. Any help would be appreciated. > > > > > > #!/usr/bin/perl > > > > use warnings; > > use strict; > > > > use Net::SSH::Perl; > > use Expect; > > > > my $host = "someHost"; > > my $sshConn = Net::SSH::Perl->new($host, port => > 22); > > $sshConn->login("someUser", > "somePassword"); > > chomp (my $cmd = 'ps -ef | grep someProcess | grep > -v grep'); > > my ($out, $err) = $sshConn->cmd($cmd || "ls > -l"); > > if (!defined $out) { > > print "\n'someProcess' is DOWN > and not running. A restart will be > attempted.\n\n"; > > my $command = Expect->spawn("sudo -u root > /usr/local/bin/someProgram") > > or die "Couldn't start program: > $!\n"; > > sleep 2; > > print $command "somePassword\r"; > > $DB::single=2; > > } else { > > print "\n'someProcess' is UP and > running.\n\n"; > > } > > $sshConn->cmd("exit"); > > > > > > > > Ron Smith > > gee...@ya... > > (213)300-9448 > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > Expectperl-discuss mailing list > > Exp...@li... > > > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > |
From: Roland G. <rgi...@cp...> - 2009-04-02 14:58:32
|
No need to fiddle with Expect, just create a check-script on the remote side that does the auto-start and call that with 'ssh remote-host check-script.sh'. HTH, Roland Ron Smith wrote: > The foolowing script is meant to ssh into another machine, check a running script and, if it's not running, start it. I'm stuck at 'Expect->spawn()'. I get: DB<3> p $command Expect=GLOB(0x9a7658c) upon debugging. I'm lost at this point. Any help would be appreciated. > > > #!/usr/bin/perl > > use warnings; > use strict; > > use Net::SSH::Perl; > use Expect; > > my $host = "someHost"; > my $sshConn = Net::SSH::Perl->new($host, port => 22); > $sshConn->login("someUser", "somePassword"); > chomp (my $cmd = 'ps -ef | grep someProcess | grep -v grep'); > my ($out, $err) = $sshConn->cmd($cmd || "ls -l"); > if (!defined $out) { > print "\n'someProcess' is DOWN and not running. A restart will be attempted.\n\n"; > my $command = Expect->spawn("sudo -u root /usr/local/bin/someProgram") > or die "Couldn't start program: $!\n"; > sleep 2; > print $command "somePassword\r"; > $DB::single=2; > } else { > print "\n'someProcess' is UP and running.\n\n"; > } > $sshConn->cmd("exit"); > > > > Ron Smith > gee...@ya... > (213)300-9448 > > ------------------------------------------------------------------------------ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: Ron S. <gee...@ya...> - 2009-04-02 13:20:55
|
The foolowing script is meant to ssh into another machine, check a running script and, if it's not running, start it. I'm stuck at 'Expect->spawn()'. I get: DB<3> p $command Expect=GLOB(0x9a7658c) upon debugging. I'm lost at this point. Any help would be appreciated. #!/usr/bin/perl use warnings; use strict; use Net::SSH::Perl; use Expect; my $host = "someHost"; my $sshConn = Net::SSH::Perl->new($host, port => 22); $sshConn->login("someUser", "somePassword"); chomp (my $cmd = 'ps -ef | grep someProcess | grep -v grep'); my ($out, $err) = $sshConn->cmd($cmd || "ls -l"); if (!defined $out) { print "\n'someProcess' is DOWN and not running. A restart will be attempted.\n\n"; my $command = Expect->spawn("sudo -u root /usr/local/bin/someProgram") or die "Couldn't start program: $!\n"; sleep 2; print $command "somePassword\r"; $DB::single=2; } else { print "\n'someProcess' is UP and running.\n\n"; } $sshConn->cmd("exit"); Ron Smith gee...@ya... (213)300-9448 |
From: Ron S. <gee...@ya...> - 2009-03-29 00:03:58
|
Hi all, I just need to start an app that asks for a password from a script. I'm 'ssh'ing in from another box, but I've got that part covered with 'Net::SSH::Perl'. I'm a little confused as to how/if I should use 'Expect'. My 'ExtUtils::Installed' list shows 'Net::SSH::Perl', 'Expect' and 'IO::Tty'. I think I have everything I need. The script I have so far is as follows: #!/usr/bin/perl use warnings; use strict; use Net::SSH::Perl; my $host = "someHost"; my $sshConn = Net::SSH::Perl->new($host, port => 22); $sshConn->login("someUserName", "somePassword"); chomp (my $cmd = 'ps -ef | grep someProcess | grep -v grep'); my ($out, $err) = $sshConn->cmd($cmd || "ls -l"); if (!defined $out) { print "\n'someProcess' is DOWN and not running.\n\n"; } else { print "\n'someProcess' is UP and running.\n\n"; } $sshConn->cmd("exit"); What I have, so far, works. But, I think I need 'Expect' to negotiate the password to 'someProcess' (no username will be asked for by the process). I'd put this after the line: print "\n'someProcess' is DOWN and not running.\n\n"; Can anyone help clear up my confusion? I'm almost there. TIA, Ron Smith gee...@ya... |
From: Roland G. <rgi...@cp...> - 2009-03-10 17:08:57
|
Try adding a match for any line after the matches for your relevant stuff and continue with expect, i.e. [ 'your_match' => sub { ... } ], [ '\n' => sub { exp_continue } ], That way expect() keeps gobbling up any lines it cannot match. Hope this helps, Roland Ivan the Perl wrote: > I'm using Expect to configure an ill-behaved network device and having > problems. > The device has the characteristic that is sends out 'lines' consisting of > '\n', or '\r\n' and nothing else. > This causes problems as '^$' will not match the later and will match > 'nothing' which does not consume any of the input that's been accumulated. > I used clear_accum when before() or after() matched the patterns in > question, but that does not seem to cause the accumulator to acquire more > content (and the expect times out). I also tried something crude like > set_accum(' ') when either of the undesirable patterns matched, just so > something ended up in the accumulator. (I was hoping to 'prime the pump' > and force another read for more input from the device.) The device timed > out. I even tried matching '^.*?\r(.*)$' and '^(?:.*?\r)?(.*)$' combined > with set_accum($1), but all that does is turn '\r\n' into '\n' which then > fails as I can't use '^$' to match. > > Has anyone run into this 'empty line' problem before? > How did you work around it? |
From: Ivan t. P. <ru...@ve...> - 2009-03-10 13:59:03
|
I'm using Expect to configure an ill-behaved network device and having problems. The device has the characteristic that is sends out 'lines' consisting of '\n', or '\r\n' and nothing else. This causes problems as '^$' will not match the later and will match 'nothing' which does not consume any of the input that's been accumulated. I used clear_accum when before() or after() matched the patterns in question, but that does not seem to cause the accumulator to acquire more content (and the expect times out). I also tried something crude like set_accum(' ') when either of the undesirable patterns matched, just so something ended up in the accumulator. (I was hoping to 'prime the pump' and force another read for more input from the device.) The device timed out. I even tried matching '^.*?\r(.*)$' and '^(?:.*?\r)?(.*)$' combined with set_accum($1), but all that does is turn '\r\n' into '\n' which then fails as I can't use '^$' to match. Has anyone run into this 'empty line' problem before? How did you work around it? -- View this message in context: http://www.nabble.com/Help-with-Ill-behaved-Device-Output-tp22434758p22434758.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: James S. (jcshen) <jc...@ci...> - 2009-02-25 00:41:44
|
Hi, Sorry this has been asked. Anyone has sample code to integrate the expect log into Log4perl ? thanks J.S. |
From: James S. (jcshen) <jc...@ci...> - 2009-02-25 00:01:29
|
Hi, Sorry this has been asked. Anyone has sample code to integrate the expect log into Log4perl ? thanks J.S. |
From: Roland G. <rgi...@cp...> - 2009-02-17 10:20:37
|
Prashar wrote: > [ > '\s*MP Host Name:(.*)', > sub { > my $fh = shift; > $tmp = ($fh->matchlist)[0]; > $tmp =~ s/\s+//g; > $tmp =~ s/^\s+//g; > exp_continue; > } > ], > "\[$tmp\] MP\> ", > > But I think $tmp will never have the value assigned to it in a #5 pattern > match routine as the list of patterns are prepared at the beginning before > spawning for match. hence we see the $tmp as null ( which was defined > globally). Right, this cannot work, you try to change the match pattern after it was already passed to the expect() call. For this to work, you must exit the first expect() call and enter another expect(), this time with the captured prompt string. Hope this helps, Roland |
From: Prashar <him...@ya...> - 2009-02-17 05:46:14
|
Thanks everyone for your kind help. I made following change to the code: [ '\s*MP Host Name:(.*)', sub { my $fh = shift; $tmp = ($fh->matchlist)[0]; $tmp =~ s/\s+//g; $tmp =~ s/^\s+//g; exp_continue; } ], "\[$tmp\] MP\> ", But I think $tmp will never have the value assigned to it in a #5 pattern match routine as the list of patterns are prepared at the beginning before spawning for match. hence we see the $tmp as null ( which was defined globally). exp_internal(1) ============== Starting EXPECT pattern matching... at /opt/perl_64/lib/site_perl/5.8.8/Expect.pm line 559 Expect::expect('Expect=GLOB(0x60000000006dc260)', 5, 'ARRAY(0x60000000006dc710)', 'ARRAY(0x60000000006dc7f0)', 'ARRAY(0x60000000006dc8c0)', 'ARRAY(0x60000000006dc980)', 'ARRAY(0x60000000006dca50)', '[] MP> ') called at ./expect_orig.pl line 88 spawn id(3): list of patterns: #2: -re `MP login: $' #3: -re `MP password: $' #4: -eof `' #5: -re `\\s*MP Host Name:(.*)' #6: -ex `[] MP> ' spawn id(3): Does `' match: pattern #2: -re `MP login: $'? No. pattern #3: -re `MP password: $'? No. pattern #4: -eof `'? No. pattern #5: -re `\\s*MP Host Name:(.*)'? No. pattern #6: -ex `[] MP> '? No. Prashar wrote: > > Hi, > > Snippet of code pasted below gets time-out as it couldnt match the string > "[spr9628-c] MP>". Could some one please temme where actually I goofed up > . > > $exp->expect($timeout, > > [ 'timeout' => sub{print "\nERROR: Timed out waiting for > telnet to close.\n"; > }], > [ > 'MP login: $', > sub { > $spawn_ok = 1; > my $fh = shift; > $fh->send("$username\n"); > exp_continue; > } > ], > [ > 'MP password: $', > sub { > my $fh = shift; > print $fh "$password\n"; > exp_continue; > } > ], > [ > eof => > sub { > if ($spawn_ok) { > die "ERROR: premature EOF in login.\n"; > } else { > die "ERROR: could not spawn telnet.\n"; > } > } > ], > [ > '-re', '\s*MP Host Name:(.*)\r', > sub { > my $fh = shift; > $tmp = ($fh->matchlist)[0]; ## $tmp = spr9628-c > $tmp =~ s/\s+//g; > $tmp =~ s/^\s+//g; > exp_continue; > } > ], > '-re', '\[$tmp\]\sMP>\s', ## Should exit expect from here > as per logic > > ); > > > > ========================== > > Output: > > MP Host Name: spr9628-c > > Revision E.03.15 > > > ************************************************************************* > MP ACCESS IS NOT SECURE > Default MP users are currently configured and remote access is enabled. > Modify default users passwords or delete default users (see UC command) > OR > Disable all types of remote access (see SA command) > ************************************************************************* > > > MP MAIN MENU: > > CO: Console > VFP: Virtual Front Panel > CM: Command Menu > CL: Console Log > SL: Show Event Logs > HE: Main Help Menu > X: Exit Connection > > [spr9628-c] MP> > ERROR: Timed out waiting for telnet to close. > > > Thanks in advance > -H > > > -- View this message in context: http://www.nabble.com/Expect-perl-tp22032953p22051159.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: Austin S. <te...@of...> - 2009-02-16 17:22:09
|
On Mon, 16 Feb 2009 09:37:01 -0500 (EST) "Bryan Bueter" <br...@bu...> wrote: > > } > > ], > > '-re', '\[$tmp\]\sMP>\s', ## Should exit expect > > from here as'\[ > > per logic > > > > ); > > > > If your using single quotes $tmp wont be expanded. Try: > "\[$tmp\]\sMP>\s" and see if that works for you. I would try something like '\[' . $tmp . '\]\sMP>\s' If you use double quotes the regex engine will see [$tmp] instead of \[$tmp\] Austin |
From: Bryan B. <br...@bu...> - 2009-02-16 14:52:28
|
> } > ], > '-re', '\[$tmp\]\sMP>\s', ## Should exit expect from here > as > per logic > > ); > If your using single quotes $tmp wont be expanded. Try: "\[$tmp\]\sMP>\s" and see if that works for you. Bryan http://sourceforge.net/projects/rover |
From: Prashar <him...@ya...> - 2009-02-16 07:59:55
|
Hi, Snippet of code pasted below gets time-out as it couldnt match the string "[spr9628-c] MP>". Could some one please temme where actually I goofed up . $exp->expect($timeout, [ 'timeout' => sub{print "\nERROR: Timed out waiting for telnet to close.\n"; }], [ 'MP login: $', sub { $spawn_ok = 1; my $fh = shift; $fh->send("$username\n"); exp_continue; } ], [ 'MP password: $', sub { my $fh = shift; print $fh "$password\n"; exp_continue; } ], [ eof => sub { if ($spawn_ok) { die "ERROR: premature EOF in login.\n"; } else { die "ERROR: could not spawn telnet.\n"; } } ], [ '-re', '\s*MP Host Name:(.*)\r', sub { my $fh = shift; $tmp = ($fh->matchlist)[0]; ## $tmp = spr9628-c $tmp =~ s/\s+//g; $tmp =~ s/^\s+//g; exp_continue; } ], '-re', '\[$tmp\]\sMP>\s', ## Should exit expect from here as per logic ); ========================== Output: MP Host Name: spr9628-c Revision E.03.15 ************************************************************************* MP ACCESS IS NOT SECURE Default MP users are currently configured and remote access is enabled. Modify default users passwords or delete default users (see UC command) OR Disable all types of remote access (see SA command) ************************************************************************* MP MAIN MENU: CO: Console VFP: Virtual Front Panel CM: Command Menu CL: Console Log SL: Show Event Logs HE: Main Help Menu X: Exit Connection [spr9628-c] MP> ERROR: Timed out waiting for telnet to close. Thanks in advance -H -- View this message in context: http://www.nabble.com/Expect-perl-tp22032953p22032953.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: Yatin M. <yat...@gm...> - 2009-02-02 10:02:17
|
Hi, I am facing issues with using Expect.pm for ssh login. In certain cases I find that the command is not sent fully to the server or it is sent without the trailing "\r" or "\n" characters. This is observed with long commands( 60 to 100 chars). Is there any issue with expect not sending full command or "\r" "\n" characters over a period of time. My script is doing following steps : 1. Login to server using ssh 2. execute aroung 10 commands in loop. 3. Every time I execute command I look for server prompt. And if prompt is found then I execute next command. If prompt is not found then my script waits indefinitely Note : All the commands are of length between 60 to 100 characters. Sample script: use Expect; my $exp = new Expect; $exp->spawn("ssh -l root $filer_ip") or die "Cannot spawn : $!\n"; my @commands =("cmd1", "cmd2", "cmd3"); while(1) { $i=0; $count=@commands; while($count>0) { (undef,$error,undef, $before_match,undef)=$exp->expect($timeout,$prompt); $exp->clear_accum(); print "\n\n## Command executed with output:\n $before_match \n##\n\n"; if ($before_match =~ /$prompt/) { $exp->send("$commands[$i]\r"); $count--; $i++; } else { $exp->clear_accum(); print("Prompt not found"); while(1){} } } } Are there any issues with my script ? Regards, Yatin |
From: Juan P. F. G. <jfe...@gm...> - 2009-01-28 05:15:18
|
Here's an example of using cu (the article is in spanish but includes a small script) http://www.fathersfate.com.mx/wordpress/2006/05/05/automatizando-con-expect-y-cu/ Good luck On Mon, Jan 26, 2009 at 11:15 AM, Patrick B. <c.p...@gm...> wrote: > > This is my first post in this forum. > > I am trying to automate the setup of a network device from scratch through a > serial connection using a combination of minicom and perl. I initially > tried using minicom's built-in runscript program to do the configuration, > but found that it didn't allow me to do some things I wanted to (like > opening config files and piping their contents to STDIN), so I changed > minicom's setup to use perl instead. > > Now my problem is how to use Expect.pm. Minicomm's documentation states > "Stdin and stdout are connected to the modem, stderr to the screen" > > I'm just trying to get the basics of interaction at this point. > So far I've got: > > ---------------- > use Expect; > > my $exp = new Expect; > $exp->raw_pty(1); > > print "\n"; > $exp->expect(3, "root]\#"); > $exp->send("ls"); > ---------------- > > When I add "$Expect::Exp_Internal = 1;" to see what's happening, I get the > following: > ---------------- > : Does `' > match: > pattern #1: -ex `root]#'? No. > > Waiting for new data (3 seconds)... > TIMEOUT > Returning from expect with TIMEOUT of EOF > ---------------- > > A standard "print" command works just fine. How do I hook expect.pm to > STDIN/STDOUT? > > Thanks, > Patrick > -- > View this message in context: http://www.nabble.com/Using-perl-and-Expect.pm-with-minicom-tp21670581p21670581.html > Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: Austin S. <te...@of...> - 2009-01-26 22:50:08
|
On Thu, Jan 22, 2009 at 12:58:25AM -0800, Venkat_ch wrote: > > Hi, > I've a test automation script. i need to send 'Contol+G' signal to make the > tool to change the mode. > Please let me know how to send 'control+G' signal to expect handle. > Otherwise let me know incase you know how to send signals to expect handle. > Sure, easy peasy. my($telnet) = Expect->spawn('telnet'); # .... whatever # you can also use the 'send' method. print $telnet "\cG" # send a signal to the telnet process. kill($signal, $telnet->pid()); Austin |
From: Austin S. <te...@of...> - 2009-01-26 22:50:08
|
On Mon, Jan 26, 2009 at 11:35:50AM -0800, Patrick B. wrote: > > This is my first post in this forum. > > I am trying to automate the setup of a network device from scratch through a > serial connection using a combination of minicom and perl. I initially > tried using minicom's built-in runscript program to do the configuration, > but found that it didn't allow me to do some things I wanted to (like > opening config files and piping their contents to STDIN), so I changed > minicom's setup to use perl instead. > > Now my problem is how to use Expect.pm. Minicomm's documentation states > "Stdin and stdout are connected to the modem, stderr to the screen" > I would use something a little more basic than minicomm for this. Try using 'cu' instead (typically part of the uucp package). Austin |
From: Patrick B. <c.p...@gm...> - 2009-01-26 19:35:54
|
This is my first post in this forum. I am trying to automate the setup of a network device from scratch through a serial connection using a combination of minicom and perl. I initially tried using minicom's built-in runscript program to do the configuration, but found that it didn't allow me to do some things I wanted to (like opening config files and piping their contents to STDIN), so I changed minicom's setup to use perl instead. Now my problem is how to use Expect.pm. Minicomm's documentation states "Stdin and stdout are connected to the modem, stderr to the screen" I'm just trying to get the basics of interaction at this point. So far I've got: ---------------- use Expect; my $exp = new Expect; $exp->raw_pty(1); print "\n"; $exp->expect(3, "root]\#"); $exp->send("ls"); ---------------- When I add "$Expect::Exp_Internal = 1;" to see what's happening, I get the following: ---------------- : Does `' match: pattern #1: -ex `root]#'? No. Waiting for new data (3 seconds)... TIMEOUT Returning from expect with TIMEOUT or EOF ---------------- A standard "print" command works just fine, but I can't get expect to read or write. How do I hook expect.pm to STDIN/STDOUT? Thanks, Patrick -- View this message in context: http://www.nabble.com/Using-perl-and-Expect.pm-with-minicom-tp21670581p21670581.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: Patrick B. <c.p...@gm...> - 2009-01-26 19:34:34
|
In perl, control signals are sent with "\c". So, 'Control+G' would be "\cG". I'm not sure if that'll work in Expect for you, but worth a shot. Hope it helps. Regards, Patrick Venkat_ch wrote: > > Hi, > I've a test automation script. i need to send 'Contol+G' signal to make > the tool to change the mode. > Please let me know how to send 'control+G' signal to expect handle. > Otherwise let me know incase you know how to send signals to expect > handle. > > Thanks and Regards, > Venkat > -- View this message in context: http://www.nabble.com/How-to-send-%27Control%2BG%27-signal-to-expect-tp21600199p21670785.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: Venkat_ch <ven...@gm...> - 2009-01-22 08:58:30
|
Hi, I've a test automation script. i need to send 'Contol+G' signal to make the tool to change the mode. Please let me know how to send 'control+G' signal to expect handle. Otherwise let me know incase you know how to send signals to expect handle. Thanks and Regards, Venkat -- View this message in context: http://www.nabble.com/How-to-send-%27Control%2BG%27-signal-to-expect-tp21600199p21600199.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: Ken I. <fn...@ua...> - 2009-01-02 22:08:53
|
On Fri, Jan 02, 2009 at 01:53:09PM -0700, Dave Donohue wrote: > Hey guys, I'm having some problems figuring out how to accomplish the below. > I'll forwarn i'm slightly newer to expect, i understand how to use it to do > what i want on a machine, but i've never done things on the local machine mid > stream and not even sure if it's doable while having a working spawn'd > connection up and running. > > I'm trying to create directories on a remote machine by using ssh. What i > want to do is something like below. > > > sub CreateAdditionalDirectories { > > foreach $line(@servers) { > > $command = "ssh $username\@$line"; > > my $exp1 = Expect->spawn($command) > or die "Cannot spawn $command: #!\n"; > @match_patterns = ("Password"); > $patidx = $exp1->expect($timeout, @match_patterns); > $exp1->send("$password\r"); > > foreach $createdirectories(@createdirectories) { > > @match_patterns = ("bash"); > $patidx = $exp1->expect($timeout, @match_patterns); > $exp1->send("/usr/local/bin/sudo mkdir $HOMEDIR/$createme/incoming/$directory\ > r"); > @match_patterns = ("bash"); > $patidx = $exp1->expect($timeout, @match_patterns); > $exp1->send("/usr/local/bin/sudo mkdir $HOMEDIR/$createme/pub/$directory\r"); > @match_patterns = ("bash"); > $patidx = $exp1->expect($timeout, @match_patterns); > }; > }; > }; > > Is the above doable? basically i want to prevent establishing multipul ssh > connections to the machine if i don't have to. Is their a way to spawn ssh > connection, then come back to just normal perl and evaluate a variable, then > act based on that variable? The purpose of expect is pretty much to do just that, to allow automating interactive processes/sessions. Your spawned ssh session persists in a process which you interact with via fifos, and can last as long as you want it to. I can't easily follow the code; maybe the formatting/indentation is lost to my mail reader; and wouldn't $server be clearer than $line? Whatever you're doing, it would likely be trivial to do in a local script if you simply set up ssh keys on the hosts and authenticate locally. If you're dealing with several servers it would be something well worth figuring out, IMHO. (I use the keychain package to make authenticated keys useable in scripts; it just sources a few environment variables to identify the ssh agent fifo, etc..) If you do that, then your code might be changed to ... foreach $createdirectories(@createdirectories) { system "ssh $line sudo mkdir " . "$HOMEDIR/$createme/incoming/$directory" . "$HOMEDIR/$createme/pub/$directory"; } I don't see any password checking for sudo, which I find confusing. Presumably you've already connected to each host to authenticate sudo. Ken -- Ken Irving |
From: Dave D. <rad...@ho...> - 2009-01-02 20:53:14
|
Hey guys, I'm having some problems figuring out how to accomplish the below. I'll forwarn i'm slightly newer to expect, i understand how to use it to do what i want on a machine, but i've never done things on the local machine mid stream and not even sure if it's doable while having a working spawn'd connection up and running. I'm trying to create directories on a remote machine by using ssh. What i want to do is something like below. sub CreateAdditionalDirectories { foreach $line(@servers) { $command = "ssh $username\@$line"; my $exp1 = Expect->spawn($command) or die "Cannot spawn $command: #!\n"; @match_patterns = ("Password"); $patidx = $exp1->expect($timeout, @match_patterns); $exp1->send("$password\r"); foreach $createdirectories(@createdirectories) { @match_patterns = ("bash"); $patidx = $exp1->expect($timeout, @match_patterns); $exp1->send("/usr/local/bin/sudo mkdir $HOMEDIR/$createme/incoming/$directory\r"); @match_patterns = ("bash"); $patidx = $exp1->expect($timeout, @match_patterns); $exp1->send("/usr/local/bin/sudo mkdir $HOMEDIR/$createme/pub/$directory\r"); @match_patterns = ("bash"); $patidx = $exp1->expect($timeout, @match_patterns); }; }; }; Is the above doable? basically i want to prevent establishing multipul ssh connections to the machine if i don't have to. Is their a way to spawn ssh connection, then come back to just normal perl and evaluate a variable, then act based on that variable? Thanks in advance, Dave _________________________________________________________________ Send e-mail anywhere. No map, no compass. http://windowslive.com/oneline/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008 |
From: Sreekanta S. P. N. (Poornima)
<poo...@al...> - 2008-12-31 04:47:54
|
Hi, I am relatively new to Perl and Perl-expect. I am trying to debug an existing Perl code with expect usage in it. We are always the following error message “Error: could not connect pty as controlling terminal! “ I believe its due to expect not getting control of terminal, but otherwise the code runs ok. How do I suppress this message or avoid it altogether? Any help is very much appreciated. This is the code snippet:- if ($command eq "ssh") { foreach my $IP (@ipAdd) { print "executing Ssh on ip =$IP\n"; my $exp = new Expect; $exp->raw_pty(1); #should be before spawning to disable echoing $exp->manual_stty(1); #should be before spawning to disable echoing my $ret = $exp->spawn("ssh $IP -t vxShell"); -------→ is this the culprit ? my $err_ = $exp->exp_error(); if(!defined($ret)) { print "Send Spawn to $ip is failed\n"; push @junk_exps,$exp; next; } $exp->expect(65, [timeout => \&setTimeout], [qr/>:/ => \&doNothing], [eof => \&setEOF] ); if(&isErr()){ print "expecting prompt on spawn to $IP Failed\n"; push @junk_exps,$exp; next; } Now the code runs on solaris. The expect is supposed to spawn ssh on Vxworks system . Now the code runs fine but it always throws this message executing Ssh on ip = 1.2.3.4 Error: could not connect pty as controlling terminal! <<<< ------- Why is this coming ? expecting prompt on spawn to 1.2.3.4 Failed or alternaltively executing Ssh on ip = 1.2.3.4 Error: could not connect pty as controlling terminal! <<<←---------- why is this message coming expecting prompt on spawn to 1.2.3.4 success Thanks Poornima |