#!/usr/bin/perl -w $ENV{'RTSERVERS'} = 'tcp:dspmon03.tdc.cingular.net:2059,tcp:dspmon01.t +dc.cingular.net:2059'; use Expect; use strict; $Expect::Log_Stdout=1; $Expect::Debug=3; $Expect::Exp_Internal=1; my $cmd = "/opt/app/bmcprod/common/bmc/bin/solaris-2-10-sparc/pslv -a +"-id DSPMON03" ./cs_get_agent_info.asm"; new Expect(); (my $rtcloud = Expect->spawn("$cmd")) || die "Couldn't spawn $cmd, $!" +; unless ($rtcloud->expect(30,"Enter a user name for the service 'PATROL +_CSERVER_DSPMON03' :")) { die "Never got username prompt from $cmd, ".$rtcloud->exp_error()."\ +n"; } print $rtcloud "b1patrol\r"; unless ($rtcloud->expect(30,"Password: ")) { die "Never got Password prompt from $cmd, ".$rtcloud->exp_error()."\ +n"; } print $rtcloud "xxxxxxxx\r";
Use of uninitialized value in concatenation (.) or string at /usr/loca +l/lib/perl5/site_perl/5.8.8/Expect.pm line 1431. Closing . at /usr/local/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x1005dcad0)') called at /usr/ +local/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x1005dcad0)') called at ./get_RT +cloud.pl line 14 eval {...} called at ./get_RTcloud.pl line 14 Expect::new('Expect') called at ./get_RTcloud.pl line 14 Use of uninitialized value in concatenation (.) or string at /usr/loca +l/lib/perl5/site_perl/5.8.8/Expect.pm line 1434. closed. Spawned '/opt/app/bmcprod/common/bmc/bin/solaris-2-10-sparc/pslv -a "- +id DSPMON03" ./cs_get_agent_info.asm' spawn id(3) Pid: 7293 Tty: /dev/pts/6 at /usr/local/lib/perl5/site_perl/5.8.8/Expect.pm line 181 Expect::spawn('Expect', '/opt/app/bmcprod/common/bmc/bin/solar +is-2-10-sparc/pslv -a "-...') called at ./get_RTcloud.pl line 16 expect(Expect=GLOB(0x1006afec0) 30 Enter a user name for the service ' +PATROL_CSERVER_DSPMON03' :) called... expect(): handling param 'Enter a user name for the service 'PATROL_CS +ERVER_DSPMON03' :'... expect(): exact match 'Enter a user name for the service 'PATROL_CSERV +ER_DSPMON03' :'... Starting EXPECT pattern matching... at /usr/local/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1006afec0)', 30, 'Enter a user n +ame for the service \'PATROL_CSERVER_DSPMON03\' :') called at ./get_R +Tcloud.pl line 18 spawn id(3): beginning expect. Timeout: 30 seconds. Current time: Tue Aug 14 15:40:11 2007 spawn id(3): list of patterns: #1: -ex `Enter a user name for the service \'PATROL_CSERVER_DSPMON03 +\' :' spawn id(3): Does `' match: pattern #1: -ex `Enter a user name for the service \'PATROL_CSERVER_ +DSPMON03\' :'? No. Waiting for new data (30 seconds)... spawn id(3): new data. spawn id(3): read 153 byte(s). INFO: Connecting to Global Namespace using tcp:dspmon03.tdc.cingular.n +et:2059,tcp:dspmon01.tdc.cingular.net:2059... INFO: Setting authentication hooks spawn id(3): Does `INFO: Connecting to Global Namespace using tcp:dspm +on03.tdc.cingular.net:2059,tcp:dspmon01.tdc.cingular.net:2059...\r\nI +NFO: Setting authentication hooks\r\n' match: pattern #1: -ex `Enter a user name for the service \'PATROL_CSERVER_ +DSPMON03\' :'? No. Waiting for new data (29 seconds)... spawn id(3): new data. spawn id(3): read 63 byte(s). Enter a user name for the service 'PATROL_CSERVER_DSPMON03' : spawn id(3): Does `INFO: Connecting to Global Namespace using tcp:dspm +on03.tdc.cingular.net:2059,tcp:dspmon01.tdc.cingular.net:2059...\r\nI +NFO: Setting authentication hooks\r\n\r\nEnter a user name for the se +rvice \'PATROL_CSERVER_DSPMON03\' :' match: pattern #1: -ex `Enter a user name for the service \'PATROL_CSERVER_ +DSPMON03\' :'? YES!! Before match string: `INFO: Connecting to Global Namespace using t +cp:dspmon03.tdc.cingular.net:2059,tcp:dspmon01.tdc.cingular.net:2059. +..\r\nINFO: Setting authentication hooks\r\n\r\n' Match string: `Enter a user name for the service \'PATROL_CSERVER_ +DSPMON03\' :' After match string: `' Matchlist: () Returning from expect successfully. spawn id(3): accumulator: `' expect(Expect=GLOB(0x1006afec0) 30 Password: ) called... expect(): handling param 'Password: '... expect(): exact match 'Password: '... Starting EXPECT pattern matching... at /usr/local/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1006afec0)', 30, 'Password: ') c +alled at ./get_RTcloud.pl line 24 spawn id(3): beginning expect. Timeout: 30 seconds. Current time: Tue Aug 14 15:40:12 2007 spawn id(3): list of patterns: #1: -ex `Password: ' spawn id(3): Does `' match: pattern #1: -ex `Password: '? No. Waiting for new data (30 seconds)... spawn id(3): new data. spawn id(3): read 10 byte(s). b1patrol spawn id(3): Does `b1patrol\r\n' match: pattern #1: -ex `Password: '? No. Waiting for new data (30 seconds)... spawn id(3): new data. spawn id(3): read 58 byte(s). Password required for the user 'b1patrol' on service 'PATR spawn id(3): Does `b1patrol\r\nPassword required for the user \'b1patr +ol\' on service \'PATR' match: pattern #1: -ex `Password: '? No. Waiting for new data (27 seconds)... spawn id(3): new data. spawn id(3): read 23 byte(s). OL_CSERVER_DSPMON03'. spawn id(3): Does `b1patrol\r\nPassword required for the user \'b1patr +ol\' on service \'PATROL_CSERVER_DSPMON03\'.\r\n' match: pattern #1: -ex `Password: '? No. Waiting for new data (27 seconds)... spawn id(3): new data. spawn id(3): read 10 byte(s). Password: spawn id(3): Does `b1patrol\r\nPassword required for the user \'b1patr +ol\' on service \'PATROL_CSERVER_DSPMON03\'.\r\nPassword: ' match: pattern #1: -ex `Password: '? YES!! Before match string: `b1patrol\r\nPassword required for the user \ +'b1patrol\' on service \'PATROL_CSERVER_DSPMON03\'.\r\n' Match string: `Password: ' After match string: `' Matchlist: () Returning from expect successfully. spawn id(3): accumulator: `' Closing spawn id(3). at /usr/local/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x1006afec0)') called at /usr/ +local/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x1006afec0)') called at ./get_RT +cloud.pl line 0 eval {...} called at ./get_RTcloud.pl line 0 spawn id(3) closed. Pid 7293 of spawn id(3) terminated, Status: 0x01
In reply to Expect.pm dealing with STDOUT by onegative
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |