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: Hailey N. <Hai...@Su...> - 2003-10-01 18:09:00
|
Hi, Please show me how to do nested telnet sessions using Expect.pm module? 1- telnet to machine A 2- from A to mcahine B 3- from M to another machine C ----- use Expect; my $exp = Expect->spawn("telnet $somehost") or die "Cannot spawn telnet: $!\n"; ... ----- Your help is greatly appreciated. Please reply directly to me since I am not on the alias. Hailey. |
From: Austin S. <te...@of...> - 2003-10-01 17:07:22
|
On Wed, Oct 01, 2003 at 11:55:51AM -0400, Harter, Douglas wrote: > Tcl/Expect has a batch of sample scripts. Those of use who are beginners in Expect would probably benefit by having these scripts available, converted to ExpectPerl of course. How about it? > Go for it! Austin |
From: Harter, D. <dh...@st...> - 2003-10-01 15:56:24
|
Tcl/Expect has a batch of sample scripts. Those of use who are beginners = in Expect would probably benefit by having these scripts available, = converted to ExpectPerl of course. How about it? |
From: Blackstone, J. D. <jda...@ci...> - 2003-09-29 15:34:33
|
If you've never read this book, I highly recommend it, even if you never intend to work with TCL Expect. Even if you never intend to work with Expect.pm, for that matter. There are a lot of insights in this book and interesting tidbits of information, particularly if you work with UNIX. If you work with any Expect-like automation language, I think you will find it invaluable. jdb |
From: Harter, D. <dh...@st...> - 2003-09-29 14:47:45
|
I will take this from the 'Exploring Expect' manual.=20 passmass sets your password on any number of hosts. The idea is that you = want to keep your password the same on all the computers that you use, = but when it comes time to change it, you only want to do it once. = passmass does this -- it logs into each machine and changes your = password for you. > -----Original Message----- > From: Chris Muth [mailto:mut...@mc...] > Sent: Monday, September 29, 2003 10:24 AM > To: exp...@li... > Subject: Re: [Expectperl-discuss] passmass >=20 >=20 > Hey, >=20 > For those of us that have never touched the Expect/TCL=20 > module, perhaps you could describe what "passmass" does? >=20 > -Chris Muth >=20 >=20 > On 9/29/03 at 8:05 AM Harter, Douglas wrote: >=20 > >Has the passmass example that comes with the regular Expect been > >converted to PerlExpect and available somewhere? > > > > > > > > > > > >------------------------------------------------------- > >This sf.net email is sponsored by:ThinkGeek > >Welcome to geek heaven. > >http://thinkgeek.com/sf > >_______________________________________________ > >Expectperl-discuss mailing list > >Exp...@li... > >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >=20 |
From: Chris M. <mut...@mc...> - 2003-09-29 14:34:11
|
Hey, For those of us that have never touched the Expect/TCL module, perhaps you= could describe what "passmass" does? -Chris Muth On 9/29/03 at 8:05 AM Harter, Douglas wrote: >Has the passmass example that comes with the regular Expect been >converted to PerlExpect and available somewhere? > > > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Expectperl-discuss mailing list >Exp...@li... >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Harter, D. <dh...@st...> - 2003-09-29 12:08:59
|
Has the passmass example that comes with the regular Expect been = converted to PerlExpect and available somewhere? |
From: Blackstone, J. D. <jda...@ci...> - 2003-09-22 12:20:29
|
> -----Original Message----- > From: Roland Giersig [mailto:RGi...@cp...] > Sent: Saturday, September 20, 2003 3:38 AM > To: Joerg Behrend > Cc: exp...@li... > Subject: Re: [Expectperl-discuss] Perl debugger hanging after > expectperl spawn in 5.8.0 > > > Joerg Behrend wrote: > > Unter perl-5.8.0, the perl debugger is hanging after > > issuing the spawn command in the perl test script shown > below (called > > from a terminal window with perl -d). Under perl-5.6.0, > debugging the > > same script works fine. > > I don't think this is an Expect-related problem, I'd rather > guess this > is a problem with the debugger in 5.8.0 given the fact that there are > plans to rewirte it from scratch... > > Spawn does a fork() and this is where the debuggers problems probably > comes from, I'd guess that the debugger also has this problem > with code > that does a simle fork(), without the Expect package loaded. > (Actually > I'm astonished that debugging spawn() works at all in 5.6.0...) I don't recall debugging ever working with Expect.pm in any Perl version I've used. I'm pretty certain I've tried this at least under 5.6.1 and 5.8.0. fork() has always confused the debugger. I think in more recent versions (5.6.1 onward?) work was done to make the debugger handle forks better. Perhaps Expect.pm worked in 5.6.0 and the work done in the debugger to fix fork() for 5.6.0 broke it? jdb |
From: Roland G. <RGi...@cp...> - 2003-09-20 08:38:50
|
Joerg Behrend wrote: > Unter perl-5.8.0, the perl debugger is hanging after > issuing the spawn command in the perl test script shown below > (called from a terminal window with perl -d). > Under perl-5.6.0, debugging the same script works fine. I don't think this is an Expect-related problem, I'd rather guess this is a problem with the debugger in 5.8.0 given the fact that there are plans to rewirte it from scratch... Spawn does a fork() and this is where the debuggers problems probably comes from, I'd guess that the debugger also has this problem with code that does a simle fork(), without the Expect package loaded. (Actually I'm astonished that debugging spawn() works at all in 5.6.0...) Servus aus Wien! Roland > The script was tested using Redhat Linux 8.0 (Intel i386) and > Redhat Advanced Server 2.1 (Itanium 2) with this result. > > Under Solaris 8, debugging works with both perl-5.8.0 and perl-5.6.0 . > > Since we are migrating to perl-5.8.0, it would be nice to have the > full debugging capability also under this version. > > Joerg Behrend > Mathematisches Institut Universitaet Koeln > > > Perl test script: > > use strict; > use Expect; > > $Expect::Debug=2; > $Expect::Exp_Internal=1; > > > my ($exp_fwatch); > my ($s_sys) = "bash"; > > $exp_fwatch = new Expect(); > $exp_fwatch->raw_pty(1); > $exp_fwatch->spawn($s_sys); > > # this part is not reached if perldb is hanging > print "after expect spawn\n"; > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: Joerg B. <jb...@MI...> - 2003-09-19 19:54:13
|
Unter perl-5.8.0, the perl debugger is hanging after issuing the spawn command in the perl test script shown below (called from a terminal window with perl -d). Under perl-5.6.0, debugging the same script works fine. The script was tested using Redhat Linux 8.0 (Intel i386) and Redhat Advanced Server 2.1 (Itanium 2) with this result. Under Solaris 8, debugging works with both perl-5.8.0 and perl-5.6.0 . Since we are migrating to perl-5.8.0, it would be nice to have the full debugging capability also under this version. Joerg Behrend Mathematisches Institut Universitaet Koeln Perl test script: use strict; use Expect; $Expect::Debug=2; $Expect::Exp_Internal=1; my ($exp_fwatch); my ($s_sys) = "bash"; $exp_fwatch = new Expect(); $exp_fwatch->raw_pty(1); $exp_fwatch->spawn($s_sys); # this part is not reached if perldb is hanging print "after expect spawn\n"; |
From: Chris M. <mut...@mc...> - 2003-09-17 19:29:30
|
Hi, Thank you all very much, I really appreciate it. :-) -Chris Muth |
From: Austin S. <te...@of...> - 2003-09-17 18:22:16
|
On Wed, Sep 17, 2003 at 11:12:12AM -0500, Chris Muth wrote: > Hey, > > I haven't the faintest idea. > Perhaps one of the two brilliant minds the suggested the fix could comment? > #close STDIN; close STDOUT; close STDERR; sleep 5; ####################################### # comment out daemonizing code ending here open (LOG_FILE, "> output"); # open log file STDIN, STDOUT, STDERR are handles associates with unix file handles #1, #2, #3. In unix when you open a new file descriptor it uses the first one available. There's a "trick" in Expect where the descriptors are reopened with the new tty in the same order they are closed. By closing them above, weird things begin to happen. First, LOG_FILE takes the STDIN fileno (0). Then the pty gets opened with the next available two filenos, which should be STDOUT and STDERR. Then the child tries to close and reopen filenos 0 and 1 as the terminal, but oops, the parent is expecting to read from the tty on fileno 2, and the child will be writing to 1. Or something like that. Austin |
From: Chris M. <mut...@mc...> - 2003-09-17 16:13:42
|
Hey, I haven't the faintest idea. Perhaps one of the two brilliant minds the suggested the fix could comment? -Chris Muth On 9/17/03 at 10:03 AM Ed Arnold wrote: >Is this because STDIN is associated with the controlling terminal? > > >> NOT closing STDIN makes the fragment work properly. >> >> Thank You, >> Chris Muth >> >> >> On 9/16/03 at 9:55 PM Austin Schutz wrote: >> >> >On Tue, Sep 16, 2003 at 09:46:51PM -0500, Chris Muth wrote: >> >> Hi, >> >> >> >> I am running; >> >> Perl 5.8 >> >> Expect 1.15 >> >> IO::Tty 1.02 >> >> IO::Stty .02 >> >> Linux 2.2.20 >> >> >> >> I am not sure how cron figures into this, I am not using it for this >> >script. >> >> >> > >> > Haha.. that's what I get for not reading. I'm not sure where I thought >> >you meant cron where you said daemonize. This script will work much >> >better if you don't close stdin/stdout/stderr. They are inherited by= the >> >children when they start. I'm not sure why that is fouling stuff up, >since >> >they get reopened anyway, but it definitely is. >> > Doing setsid() should make it so it doesn't die when the original >> >terminal is closed, but you may want to do setpgrp() so it doesn't die >when >> >the parent (your shell) dies. >> > >> > Austin >> >> >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> Expectperl-discuss mailing list >> Exp...@li... >> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Chris M. <mut...@mc...> - 2003-09-17 15:02:17
|
NOT closing STDIN makes the fragment work properly. Thank You, Chris Muth On 9/16/03 at 9:55 PM Austin Schutz wrote: >On Tue, Sep 16, 2003 at 09:46:51PM -0500, Chris Muth wrote: >> Hi, >> >> I am running; >> Perl 5.8 >> Expect 1.15 >> IO::Tty 1.02 >> IO::Stty .02 >> Linux 2.2.20 >> >> I am not sure how cron figures into this, I am not using it for this >script. >> > > Haha.. that's what I get for not reading. I'm not sure where I thought >you meant cron where you said daemonize. This script will work much >better if you don't close stdin/stdout/stderr. They are inherited by the >children when they start. I'm not sure why that is fouling stuff up, since >they get reopened anyway, but it definitely is. > Doing setsid() should make it so it doesn't die when the original >terminal is closed, but you may want to do setpgrp() so it doesn't die= when >the parent (your shell) dies. > > Austin |
From: Chris M. <mut...@mc...> - 2003-09-17 15:00:16
|
YES! I did the same and the fragment works flawlessly. My little trick of closing then reopening STDOUT and STDERR to a file even works now :-) Thanks, Chris Muth On 9/16/03 at 9:24 PM expect wrote: > >I commented this > >#close STDIN; > > |
From: Austin S. <te...@of...> - 2003-09-17 04:55:48
|
On Tue, Sep 16, 2003 at 09:46:51PM -0500, Chris Muth wrote: > Hi, > > I am running; > Perl 5.8 > Expect 1.15 > IO::Tty 1.02 > IO::Stty .02 > Linux 2.2.20 > > I am not sure how cron figures into this, I am not using it for this script. > Haha.. that's what I get for not reading. I'm not sure where I thought you meant cron where you said daemonize. This script will work much better if you don't close stdin/stdout/stderr. They are inherited by the children when they start. I'm not sure why that is fouling stuff up, since they get reopened anyway, but it definitely is. Doing setsid() should make it so it doesn't die when the original terminal is closed, but you may want to do setpgrp() so it doesn't die when the parent (your shell) dies. Austin |
From: expect <ex...@ih...> - 2003-09-17 04:24:34
|
On Sun, 14 Sep 2003 16:27:52 -0500 "Chris Muth" <mut...@mc...> wrote: > Hi, > > I am working on a script that daemonizes and then uses > ssh to login/operate/logout of a remote machine. > > The code works perfectly when it is not demonized, (with the demonization > code commented out). The script will run and partially work if the > code (the lines indicated below) is left in,-- it will fork, detach, and > sleep but fail to get the command prompt on the remote machine. > I have it log to a file (LOG_FILE), because when it is daemonized I cannot > see the output. > > The only thing I can think of is that ssh must do something to the > terminal/console that works > when I run it manually on the console, but when the program > is daemonized, ssh cannot do whatever it is trying to do and fails. > > The segment below fails saying "never got command prompt". This means that > it got the password prompt from the remote machine > and sent the password, but never got the command prompt after that. > > I don't think this is an expect problem, I think that it is a problem with > how ssh and expect work together. > My guess is that ssh is not intentionally failing, but it is trying to do > something that does not work with the terminal that expect uses. > > I have even tried "ssh -l root" to specify the username, "ssh -T" so ssh > won't allocate a pseudo-tty, and not setting the pty to raw; all to no > avail. > > Does anyone have any ideas? > Below is the code segment. > > Thanks, > -Chris Muth > > > #!/usr/bin/perl5.8 -w > > #prompt user for host to login to, and password > print"host: ";$host=<STDIN>;chomp$host; > print"pass: ";$pass=<STDIN>;chomp$pass; > > use Expect; $Expect::Debug = 1; > use POSIX; > > # Comment out daemonizing code starting here > ####################################### > $pid = fork(); > exit 0 if ($pid); > > POSIX::setsid(); > close STDIN; I commented this #close STDIN; > close STDOUT; > close STDERR; > > sleep 5; > ####################################### > # comment out daemonizing code ending here > > open (LOG_FILE, "> output"); # open log file > > $exp = new Expect; > $exp->raw_pty(1); > > # login to the remote host > #$exp->spawn("/usr/local/bin/ssh",'-T',"$host"); # Even tried ssh -T > $exp->spawn("/usr/local/bin/ssh","$host"); and had to do this (probably not pertinent to your problem) $exp->spawn("/usr/local/bin/ssh","usernameonremotehost\@$host"); And it worked. If it's not suitable as a solution it should provide the clue. > > # wait for Password: prompt > $retval = $exp->expect(30,'-re','word:\s$'); > if (!defined $retval){ > print LOG_FILE "Never got password prompt\n"; flush LOG_FILE; > } else { > $exp->send("$pass\n"); > #($retval,undef,$retstr,undef,undef) = $exp->expect(30,'stdin: is not a tty'); # for ssh -T > ($retval,undef,$retstr,undef,undef) = $exp->expect(30,'# '); > > # do something on the remote machine, test results > if (!defined $retval){ > print LOG_FILE "Never got command prompt\n"; flush LOG_FILE; > } else { > print LOG_FILE "\"$retstr\"\n"; flush LOG_FILE; > $exp->send("echo Hello World\n"); > $exp->expect(5,'This will make expect sleep for 5 seconds'); > $exp->send("logout\n"); > print LOG_FILE "It worked\n"; flush LOG_FILE; > } > } > $exp->hard_close(); > print LOG_FILE "\n"; flush LOG_FILE; > close LOG_FILE; > exit 0; > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > |
From: Chris M. <mut...@mc...> - 2003-09-17 03:00:48
|
Whoops, I forgot to mention I am running OpenSSH_3.4p1 -Chris Muth |
From: Chris M. <mut...@mc...> - 2003-09-17 02:48:16
|
I don't think that is the problem. The only difference between working and not is whether it is daemonized or= not. -Chris Muth On 9/16/03 at 9:01 AM Chris Snyder wrote: >Have you considered that the prompt is just not what you think it is? >Have you considered setting the prompt match to something very wide such >as /.+/? > >Just my two cents, >Chris |
From: Chris M. <mut...@mc...> - 2003-09-17 02:48:15
|
Hi, I am running; Perl 5.8 Expect 1.15 IO::Tty 1.02 IO::Stty .02 Linux 2.2.20 I am not sure how cron figures into this, I am not using it for this= script. As I mentioned in my original post, I had kind of thought that the problem= was that ssh was not working properly with expect/my script once daemonized. Am I correct in guessing that ssh opening /dev/tty to read the password= because that is more secure than simply reading stdin? If this is the case, I might be= able to simply modify ssh to just read from stdin. What do you think? Thanks, Chris Muth On 9/16/03 at 3:53 PM Roland Giersig wrote: >What system are you running on? You ARE using the latest version of >IO::Tty, I suppose... > >The problem is: ssh is opening /dev/tty to read the password. If the >script is started in a terminal session, /dev/tty is defined and Expect >will redirect it for the spawned program to the pty, so the password >prompt is seen. > >When the script is started via cron, there is no controlling terminal >and obviously Expect cannot take control of it (it would have to create >it), so ssh cannot get the password and thus fails. > >Even though I've had my share at kernel hacking, I do not know how to >resolve this, especially given that this is probably highly >system-dependend... > >Workaround: set up public key authentication for ssh, so ssh doesn't ask >for a password. But then you'd probably won't need Expect at all... > >Hope this helps, > >Roland > >Chris Muth wrote: > >> Hi, >> >> I am working on a script that daemonizes and then uses >> ssh to login/operate/logout of a remote machine. >> >> The code works perfectly when it is not demonized, (with the= demonization >> code commented out). The script will run and partially work if the >> code (the lines indicated below) is left in,-- it will fork, detach, and >> sleep but fail to get the command prompt on the remote machine. >> I have it log to a file (LOG_FILE), because when it is daemonized I >cannot >> see the output. >> >> The only thing I can think of is that ssh must do something to the >> terminal/console that works >> when I run it manually on the console, but when the program >> is daemonized, ssh cannot do whatever it is trying to do and fails. >> >> The segment below fails saying "never got command prompt". This means >that >> it got the password prompt from the remote machine >> and sent the password, but never got the command prompt after that. >> >> I don't think this is an expect problem, I think that it is a problem >with >> how ssh and expect work together. >> My guess is that ssh is not intentionally failing, but it is trying to= do >> something that does not work with the terminal that expect uses. >> >> I have even tried "ssh -l root" to specify the username, "ssh -T" so ssh >> won't allocate a pseudo-tty, and not setting the pty to raw; all to no >> avail. >> >> Does anyone have any ideas? >> Below is the code segment. >> >> Thanks, >> -Chris Muth >> >> >> #!/usr/bin/perl5.8 -w >> >> #prompt user for host to login to, and password >> print"host: ";$host=3D<STDIN>;chomp$host; >> print"pass: ";$pass=3D<STDIN>;chomp$pass; >> >> use Expect; >> use POSIX; >> >> # Comment out daemonizing code starting here >> ####################################### >> $pid =3D fork(); >> exit 0 if ($pid); >> >> POSIX::setsid(); >> close STDIN; >> close STDOUT; >> close STDERR; >> >> sleep 5; >> ####################################### >> # comment out daemonizing code ending here >> >> open (LOG_FILE, "> output"); # open log file >> >> $exp =3D new Expect; >> $exp->raw_pty(1); >> >> # login to the remote host >> #$exp->spawn("/usr/local/bin/ssh",'-T',"$host"); # Even tried ssh -T >> $exp->spawn("/usr/local/bin/ssh","$host"); >> >> # wait for Password: prompt >> $retval =3D $exp->expect(30,'-re','word:\s$'); >> if (!defined $retval){ >> print LOG_FILE "Never got password prompt\n"; flush LOG_FILE; >> } else { >> $exp->send("$pass\n"); >> #($retval,undef,$retstr,undef,undef) =3D $exp->expect(30,'stdin: is= not >a tty'); # for ssh -T >> ($retval,undef,$retstr,undef,undef) =3D $exp->expect(30,'# '); >> >> # do something on the remote machine, test results >> if (!defined $retval){ >> print LOG_FILE "Never got command prompt\n"; flush LOG_FILE; >> } else { >> print LOG_FILE "\"$retstr\"\n"; flush LOG_FILE; >> $exp->send("echo Hello World\n"); >> $exp->expect(5,'This will make expect sleep for 5 seconds'); >> $exp->send("logout\n"); >> print LOG_FILE "It worked\n"; flush LOG_FILE; >> } >> } >> $exp->hard_close(); >> print LOG_FILE "\n"; flush LOG_FILE; >> close LOG_FILE; >> exit 0; >> >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> Expectperl-discuss mailing list >> Exp...@li... >> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >> |
From: Roland G. <RGi...@cp...> - 2003-09-16 22:22:11
|
Rogaski, Mark, ALABS wrote: > Would this work? > > $exp->spawn("/usr/local/bin/ssh -tt $host"); No, the -t option forces tty-allocation at the remote (sshd server) side, we are talking about the client side here... Basically Expect would have to mimick what login or sshd is doing when allocating a pty. And it somewhat does (I got the pty allocation code partially from sshd). Hmm... there was some call that is only available to the superuser, maybe that's the missing one to correctly allocate the controlling tty... I left it out because it would only work for root, but maybe... I'll look into the issue when I have some spare time next week... Roland |
From: Rogaski, M. A. <ro...@at...> - 2003-09-16 21:44:28
|
Would this work? $exp->spawn("/usr/local/bin/ssh -tt $host"); Mark -- Mark Rogaski "Computers save time like kudzu prevents Multi-service Data Field Support soil erosion." -- Al Castanoli email: ro...@at... voice: +1-732-885-7534 pager: +1-888-858-7243 p: 200853 or 20...@pa... -----Original Message----- From: db...@CT... [mailto:db...@CT...] Sent: Tuesday, September 16, 2003 2:33 PM To: Chris Muth Cc: exp...@li...; exp...@li... Subject: Re: [Expectperl-discuss] ssh works from console but not once daemonized actually, to be more correct: $exp->spawn("/bin/sh -c \"exec /usr/local/bin/ssh $host\""); =20 db...@CT... Sent by: To: Chris Muth <mut...@mc...> =20 exp...@li...urc cc: exp...@li..., =20 eforge.net exp...@li... =20 Subject: Re: [Expectperl-discuss] ssh works from =20 console but not once daemonized =20 09/16/2003 01:51 PM =20 =20 I'm wondering if spawning a "sh -c" to exec ssh instead of the ssh directly would work? i.e., something like: $exp->spawn("/bin/sh -c \"exec /usr/local/bin/ssh\"","$host"); Roland Giersig <RGi...@cp...> Sent by: To: exp...@li... exp...@li...urc cc: eforge.net Subject: Re: [Expectperl-discuss] ssh works from console but not once daemonized 09/16/2003 10:00 AM What system are you running on? You ARE using the latest version of IO::Tty, I suppose... The problem is: ssh is opening /dev/tty to read the password. If the script is started in a terminal session, /dev/tty is defined and Expect will redirect it for the spawned program to the pty, so the password prompt is seen. When the script is started via cron, there is no controlling terminal and obviously Expect cannot take control of it (it would have to create it), so ssh cannot get the password and thus fails. Even though I've had my share at kernel hacking, I do not know how to resolve this, especially given that this is probably highly system-dependend... Workaround: set up public key authentication for ssh, so ssh doesn't ask for a password. But then you'd probably won't need Expect at all... Hope this helps, Roland Chris Muth wrote: > Hi, > > I am working on a script that daemonizes and then uses > ssh to login/operate/logout of a remote machine. > > The code works perfectly when it is not demonized, (with the demonization > code commented out). The script will run and partially work if the > code (the lines indicated below) is left in,-- it will fork, detach, and > sleep but fail to get the command prompt on the remote machine. > I have it log to a file (LOG_FILE), because when it is daemonized I cannot > see the output. > > The only thing I can think of is that ssh must do something to the > terminal/console that works > when I run it manually on the console, but when the program > is daemonized, ssh cannot do whatever it is trying to do and fails. > > The segment below fails saying "never got command prompt". This means that > it got the password prompt from the remote machine > and sent the password, but never got the command prompt after that. > > I don't think this is an expect problem, I think that it is a problem with > how ssh and expect work together. > My guess is that ssh is not intentionally failing, but it is trying to do > something that does not work with the terminal that expect uses. > > I have even tried "ssh -l root" to specify the username, "ssh -T" so ssh > won't allocate a pseudo-tty, and not setting the pty to raw; all to no > avail. > > Does anyone have any ideas? > Below is the code segment. > > Thanks, > -Chris Muth > > > #!/usr/bin/perl5.8 -w > > #prompt user for host to login to, and password > print"host: ";$host=3D<STDIN>;chomp$host; > print"pass: ";$pass=3D<STDIN>;chomp$pass; > > use Expect; > use POSIX; > > # Comment out daemonizing code starting here > ####################################### > $pid =3D fork(); > exit 0 if ($pid); > > POSIX::setsid(); > close STDIN; > close STDOUT; > close STDERR; > > sleep 5; > ####################################### > # comment out daemonizing code ending here > > open (LOG_FILE, "> output"); # open log file > > $exp =3D new Expect; > $exp->raw_pty(1); > > # login to the remote host > #$exp->spawn("/usr/local/bin/ssh",'-T',"$host"); # Even tried ssh -T > $exp->spawn("/usr/local/bin/ssh","$host"); > > # wait for Password: prompt > $retval =3D $exp->expect(30,'-re','word:\s$'); > if (!defined $retval){ > print LOG_FILE "Never got password prompt\n"; flush LOG_FILE; > } else { > $exp->send("$pass\n"); > #($retval,undef,$retstr,undef,undef) =3D $exp->expect(30,'stdin: is not a tty'); # for ssh -T > ($retval,undef,$retstr,undef,undef) =3D $exp->expect(30,'# '); > > # do something on the remote machine, test results > if (!defined $retval){ > print LOG_FILE "Never got command prompt\n"; flush LOG_FILE; > } else { > print LOG_FILE "\"$retstr\"\n"; flush LOG_FILE; > $exp->send("echo Hello World\n"); > $exp->expect(5,'This will make expect sleep for 5 seconds'); > $exp->send("logout\n"); > print LOG_FILE "It worked\n"; flush LOG_FILE; > } > } > $exp->hard_close(); > print LOG_FILE "\n"; flush LOG_FILE; > close LOG_FILE; > exit 0; > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Austin S. <te...@of...> - 2003-09-16 19:29:16
|
On Sun, Sep 14, 2003 at 04:27:52PM -0500, Chris Muth wrote: > Does anyone have any ideas? The following code snippet works fine for me when called from cron. I recall having problems using expect with early versions of ssh. Perhaps you could tell us your OS, ssh, Expect, and IO::Tty versions? Btw, in reponse to a couple other postings, Expect uses IO::Tty to create a tty to run the command in and sets its controlling terminal to the tty it creates. Reads and writes to /dev/tty should work just fine. That's the idea anyway, and it works here just fine. I'm using: Expect v. 1.15, IO::Tty v. 1.00, perl 5.6.1, ssh OpenSSH_3.5p1, Linux, kernel ver. 2.4.20 Austin #!/usr/bin/perl -w use Expect; $ssh = new Expect; $ssh->spawn("/usr/local/bin/ssh", "localhost"); $ssh->expect(10, "password: "); print $ssh "$ARGV[0]\n"; $ssh->expect(10, '$' ); |
From: <db...@CT...> - 2003-09-16 18:33:35
|
actually, to be more correct: $exp->spawn("/bin/sh -c \"exec /usr/local/bin/ssh $host\""); db...@CT... Sent by: To: Chris Muth <mut...@mc...> exp...@li...urc cc: exp...@li..., eforge.net exp...@li... Subject: Re: [Expectperl-discuss] ssh works from console but not once daemonized 09/16/2003 01:51 PM I'm wondering if spawning a "sh -c" to exec ssh instead of the ssh directly would work? i.e., something like: $exp->spawn("/bin/sh -c \"exec /usr/local/bin/ssh\"","$host"); Roland Giersig <RGi...@cp...> Sent by: To: exp...@li... exp...@li...urc cc: eforge.net Subject: Re: [Expectperl-discuss] ssh works from console but not once daemonized 09/16/2003 10:00 AM What system are you running on? You ARE using the latest version of IO::Tty, I suppose... The problem is: ssh is opening /dev/tty to read the password. If the script is started in a terminal session, /dev/tty is defined and Expect will redirect it for the spawned program to the pty, so the password prompt is seen. When the script is started via cron, there is no controlling terminal and obviously Expect cannot take control of it (it would have to create it), so ssh cannot get the password and thus fails. Even though I've had my share at kernel hacking, I do not know how to resolve this, especially given that this is probably highly system-dependend... Workaround: set up public key authentication for ssh, so ssh doesn't ask for a password. But then you'd probably won't need Expect at all... Hope this helps, Roland Chris Muth wrote: > Hi, > > I am working on a script that daemonizes and then uses > ssh to login/operate/logout of a remote machine. > > The code works perfectly when it is not demonized, (with the demonization > code commented out). The script will run and partially work if the > code (the lines indicated below) is left in,-- it will fork, detach, and > sleep but fail to get the command prompt on the remote machine. > I have it log to a file (LOG_FILE), because when it is daemonized I cannot > see the output. > > The only thing I can think of is that ssh must do something to the > terminal/console that works > when I run it manually on the console, but when the program > is daemonized, ssh cannot do whatever it is trying to do and fails. > > The segment below fails saying "never got command prompt". This means that > it got the password prompt from the remote machine > and sent the password, but never got the command prompt after that. > > I don't think this is an expect problem, I think that it is a problem with > how ssh and expect work together. > My guess is that ssh is not intentionally failing, but it is trying to do > something that does not work with the terminal that expect uses. > > I have even tried "ssh -l root" to specify the username, "ssh -T" so ssh > won't allocate a pseudo-tty, and not setting the pty to raw; all to no > avail. > > Does anyone have any ideas? > Below is the code segment. > > Thanks, > -Chris Muth > > > #!/usr/bin/perl5.8 -w > > #prompt user for host to login to, and password > print"host: ";$host=<STDIN>;chomp$host; > print"pass: ";$pass=<STDIN>;chomp$pass; > > use Expect; > use POSIX; > > # Comment out daemonizing code starting here > ####################################### > $pid = fork(); > exit 0 if ($pid); > > POSIX::setsid(); > close STDIN; > close STDOUT; > close STDERR; > > sleep 5; > ####################################### > # comment out daemonizing code ending here > > open (LOG_FILE, "> output"); # open log file > > $exp = new Expect; > $exp->raw_pty(1); > > # login to the remote host > #$exp->spawn("/usr/local/bin/ssh",'-T',"$host"); # Even tried ssh -T > $exp->spawn("/usr/local/bin/ssh","$host"); > > # wait for Password: prompt > $retval = $exp->expect(30,'-re','word:\s$'); > if (!defined $retval){ > print LOG_FILE "Never got password prompt\n"; flush LOG_FILE; > } else { > $exp->send("$pass\n"); > #($retval,undef,$retstr,undef,undef) = $exp->expect(30,'stdin: is not a tty'); # for ssh -T > ($retval,undef,$retstr,undef,undef) = $exp->expect(30,'# '); > > # do something on the remote machine, test results > if (!defined $retval){ > print LOG_FILE "Never got command prompt\n"; flush LOG_FILE; > } else { > print LOG_FILE "\"$retstr\"\n"; flush LOG_FILE; > $exp->send("echo Hello World\n"); > $exp->expect(5,'This will make expect sleep for 5 seconds'); > $exp->send("logout\n"); > print LOG_FILE "It worked\n"; flush LOG_FILE; > } > } > $exp->hard_close(); > print LOG_FILE "\n"; flush LOG_FILE; > close LOG_FILE; > exit 0; > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: <db...@CT...> - 2003-09-16 17:52:32
|
I'm wondering if spawning a "sh -c" to exec ssh instead of the ssh directly would work? i.e., something like: $exp->spawn("/bin/sh -c \"exec /usr/local/bin/ssh\"","$host"); Roland Giersig <RGi...@cp...> Sent by: To: exp...@li... exp...@li...urc cc: eforge.net Subject: Re: [Expectperl-discuss] ssh works from console but not once daemonized 09/16/2003 10:00 AM What system are you running on? You ARE using the latest version of IO::Tty, I suppose... The problem is: ssh is opening /dev/tty to read the password. If the script is started in a terminal session, /dev/tty is defined and Expect will redirect it for the spawned program to the pty, so the password prompt is seen. When the script is started via cron, there is no controlling terminal and obviously Expect cannot take control of it (it would have to create it), so ssh cannot get the password and thus fails. Even though I've had my share at kernel hacking, I do not know how to resolve this, especially given that this is probably highly system-dependend... Workaround: set up public key authentication for ssh, so ssh doesn't ask for a password. But then you'd probably won't need Expect at all... Hope this helps, Roland Chris Muth wrote: > Hi, > > I am working on a script that daemonizes and then uses > ssh to login/operate/logout of a remote machine. > > The code works perfectly when it is not demonized, (with the demonization > code commented out). The script will run and partially work if the > code (the lines indicated below) is left in,-- it will fork, detach, and > sleep but fail to get the command prompt on the remote machine. > I have it log to a file (LOG_FILE), because when it is daemonized I cannot > see the output. > > The only thing I can think of is that ssh must do something to the > terminal/console that works > when I run it manually on the console, but when the program > is daemonized, ssh cannot do whatever it is trying to do and fails. > > The segment below fails saying "never got command prompt". This means that > it got the password prompt from the remote machine > and sent the password, but never got the command prompt after that. > > I don't think this is an expect problem, I think that it is a problem with > how ssh and expect work together. > My guess is that ssh is not intentionally failing, but it is trying to do > something that does not work with the terminal that expect uses. > > I have even tried "ssh -l root" to specify the username, "ssh -T" so ssh > won't allocate a pseudo-tty, and not setting the pty to raw; all to no > avail. > > Does anyone have any ideas? > Below is the code segment. > > Thanks, > -Chris Muth > > > #!/usr/bin/perl5.8 -w > > #prompt user for host to login to, and password > print"host: ";$host=<STDIN>;chomp$host; > print"pass: ";$pass=<STDIN>;chomp$pass; > > use Expect; > use POSIX; > > # Comment out daemonizing code starting here > ####################################### > $pid = fork(); > exit 0 if ($pid); > > POSIX::setsid(); > close STDIN; > close STDOUT; > close STDERR; > > sleep 5; > ####################################### > # comment out daemonizing code ending here > > open (LOG_FILE, "> output"); # open log file > > $exp = new Expect; > $exp->raw_pty(1); > > # login to the remote host > #$exp->spawn("/usr/local/bin/ssh",'-T',"$host"); # Even tried ssh -T > $exp->spawn("/usr/local/bin/ssh","$host"); > > # wait for Password: prompt > $retval = $exp->expect(30,'-re','word:\s$'); > if (!defined $retval){ > print LOG_FILE "Never got password prompt\n"; flush LOG_FILE; > } else { > $exp->send("$pass\n"); > #($retval,undef,$retstr,undef,undef) = $exp->expect(30,'stdin: is not a tty'); # for ssh -T > ($retval,undef,$retstr,undef,undef) = $exp->expect(30,'# '); > > # do something on the remote machine, test results > if (!defined $retval){ > print LOG_FILE "Never got command prompt\n"; flush LOG_FILE; > } else { > print LOG_FILE "\"$retstr\"\n"; flush LOG_FILE; > $exp->send("echo Hello World\n"); > $exp->expect(5,'This will make expect sleep for 5 seconds'); > $exp->send("logout\n"); > print LOG_FILE "It worked\n"; flush LOG_FILE; > } > } > $exp->hard_close(); > print LOG_FILE "\n"; flush LOG_FILE; > close LOG_FILE; > exit 0; > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |