mod_perl2 interactive startup
I am in the process of porting a mod_perl app to mod_perl2.
The original mod_perl app has an interactive startup during which a DB
password is prompted for.
During the mod_perl2 startup this feature works fine at first but
mod_perl2 always does a restart and during the second restart STDERR
is being redirected to the log files and STDIN is ignored.
So I am trying to figure out how to either:
1) Prevent the automatic restart or
2) Have STDERR and STDIN be tied to the terminal during the restart
the same way they are during the initial start
Here info about my system: Apache/2.2.9 (Debian)
mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0
Thank you in advance for any help/insight.
--Alex
Re: mod_perl2 interactive startup
Malloy - thanks for responding.
Unfortunately using restart_count does not address my issue.
In the http.conf I have the following:
....
PerlConfigRequire conf/startup.pl
....
My test startup.pl has this:
our $INPUT;
print STDERR "Input:";
$INPUT =3D <STDIN>;
print STDERR "you entered $INPUT";
My issue is during the first start everything works as I need it to,
"Input:" is printed out to the terminal and the script waits for input.
The problem is for the automatic restart everything is tied to the log files=
..
Everything printed to STDERR goes into the logs and a user cannot
enter any input.
For the restart how can I print messages and prompt for input?
Thanks.
---Alex
Quoting Malloy <jackworker [at] gmail.com>:
> Dealing with Restarts
>
> Ideally the code running at the server startup shouldn't be affected by th=
e
> apache restart. If however this is not the case, you can use
> Apache2::ServerUtil::restart_count.
>
> More Info: http://perl.apache.org/docs/2.0/user/handlers/server.html
>
>
> On Wed, Aug 19, 2009 at 4:54 AM, <amalek [at] solutionsforprogress.com> wrote:
>
>> I am in the process of porting a mod_perl app to mod_perl2.
>>
>> The original mod_perl app has an interactive startup during which a DB
>> password is prompted for.
>>
>> During the mod_perl2 startup this feature works fine at first but mod_per=
l2
>> always does a restart and during the second restart STDERR is being
>> redirected to the log files and STDIN is ignored.
>>
>> So I am trying to figure out how to either:
>> 1) Prevent the automatic restart or
>> 2) Have STDERR and STDIN be tied to the terminal during the restart the
>> same way they are during the initial start
>>
>> Here info about my system: Apache/2.2.9 (Debian) mod_apreq2-20051231/2.6.=
0
>> mod_perl/2.0.4 Perl/v5.10.0
>>
>> Thank you in advance for any help/insight.
>>
>> --Alex
>>
>>
>
>
> --
> Jack Malloy
>
Re: mod_perl2 interactive startup
On Tue 25 Aug 2009, amalek [at] solutionsforprogress.com wrote:
> Unfortunately using restart_count does not address my issue.
>
> In the http.conf I have the following:
> ...
> PerlConfigRequire =C2=A0 conf/startup.pl
> ...
>
> My test startup.pl has this:
>
> =C2=A0 =C2=A0 =C2=A0our $INPUT;
> =C2=A0 =C2=A0 =C2=A0print STDERR "Input:";
> =C2=A0 =C2=A0 =C2=A0$INPUT =3D <STDIN>;
> =C2=A0 =C2=A0 =C2=A0print STDERR "you entered $INPUT";
>
> My issue is during the first start everything works as I need it to,
> =C2=A0 "Input:" is printed out to the terminal and the script waits for
> input.
>
> The problem is for the automatic restart everything is tied to the
> log files. Everything printed to STDERR goes into the logs and a user
> cannot enter any input.
>
> For the restart how can I print messages and prompt for input?
Don't know if it actually works, but how about POSIX::dup2()ing
STDERR/STDIN (or better opening /dev/tty and use this one for reading
and writing) to well known file descriptors (say 1000, 1001) when
restart_count=3D=3D0. Then when restart_count>0 you should be able to use
them.
Torsten
=2D-
Need professional mod_perl support?
Just hire me: torsten.foertsch [at] gmx.net
Re: mod_perl2 interactive startup
On Tue, Aug 18, 2009 at 4:54 PM, <amalek [at] solutionsforprogress.com> wrote:
> During the mod_perl2 startup this feature works fine at first but mod_perl2
> always does a restart and during the second restart STDERR is being
> redirected to the log files and STDIN is ignored.
I suggest stashing the data somewhere and picking it up during
restart, like an environment variable or shared memory or a file.
- Perrin