From: Peter E. <pe...@bo...> - 2004-06-01 17:52:44
|
It appears that last last week I became a bit overzealous in my desire to be done with the project, so I'm back to it again. OS: RH7.3 Process gets started from an init.d script which uses the daemon() found in the init.d/functions to run as non-priv'd user. The first thing my parent does is typical W Richard Stevens: close(STDIN); close(STDOUT); close(STDERR); POSIX::setsid(); chdir("/"); ... Then eventually it comes around to me where I: use Expect; ... $self->{_exp} = new Expect; $self->{_exp}->raw_pty(1); ... my @cmd = '/usr/bin/ftps'; push @cmd, '-e'; push @cmd, '-P', $self->{_port}; push @cmd, '-d' if ($self->{_debug}); push @cmd, '-p' if ($self->{_passive}); push @cmd, '-n' if ($self->{_autologin}); push @cmd, $self->{'_host'}; my $c = join ' ', @cmd; #becomes: /usr/bin/ftps -e -P 21 <host> $exp->log_file("/tmp/exp-$$", 'w') if ($DEBUG); $exp->spawn(@cmd) || return 0; $exp->expect($self->{_timeout}, [ qr/Name /i => sub { my $self = shift; $self->send($user . "\n"); exp_continue; }], [ qr/Password:/i => sub { my $self = shift; $self->send($pass . "\n"); exp_continue; }], $self->{_prompt}); And it's here that I time out never getting authenticated. In fact exactly nothing is written to the /tmp/exp-$$ file. If I run the same script, called the same, from a tty as the user that daemon() sets to, it works swell. I'm open to any thoughts, ideas, criticisms, etc. peter > From: Austin Schutz <te...@of...> > Date: Fri, 28 May 2004 10:35:56 -0700 > To: Peter Eisch <pe...@bo...> > Cc: exp...@li... > Subject: Re: [Expectperl-discuss] My tty drama > > On Fri, May 28, 2004 at 11:35:24AM -0500, Peter Eisch wrote: >> >> Yes, the difference is whether it runs as root or not. In fact, if I pull >> out all the tty calls except for raw_tty(1) and don't run as root it all >> chugs along just fine. >> >> My calls to expect() were messy to, my lesson for 'self' this morning is >> don't expect '' before sending the command, just stinking send the command. >> >> It just started working here in the last 20 mins and I have some stuff to do >> before I can get back to cleaning this up, but I'll fire off a redux when I >> can. >> > > Btw, what type of system are you trying to run this on? > > Austin > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |