Executing a background script from embedded perl

Hi guys just wondering if you could run
exec(“sleep 200 &”) in an embedded perl script and let nginx keep doing
its
thing.

Obviously sleep is just an example however i don’t appear to be able to
run
a program in the background.
the nginx process waits until the backgrounded script completes before
continuing.

Kingsley F.
Technical Leader Content Services / Content Management Group

=============================================
Internode Systems Pty Ltd

PO Box 284, Rundle Mall 5000
Level 5 150 Grenfell Street, Adelaide 5000
Phone: +61 8 8228 2978
Fax: +61 8 8235 6978
Web: http://www.internode.on.net
http://games.on.net

On Thu, Sep 11, 2008 at 05:05:26PM +0930, Kingsley F. wrote:

Hi guys just wondering if you could run
exec(“sleep 200 &”) in an embedded perl script and let nginx keep doing its
thing.

Obviously sleep is just an example however i don’t appear to be able to run
a program in the background.
the nginx process waits until the backgrounded script completes before
continuing.

ngx_http_perl_module waits perl only, so in this case the perl waits
exec().

On Thu, Sep 11, 2008 at 05:05:26PM +0930, Kingsley F. wrote:

Hi guys just wondering if you could run
exec(“sleep 200 &”) in an embedded perl script and let nginx keep doing its
thing.

Obviously sleep is just an example however i don’t appear to be able to run
a program in the background.
the nginx process waits until the backgrounded script completes before
continuing.

BTW, does not call fcntl(F_SETFD, FD_CLOEXEC) for sockets/etc., so
all these files will be inherited to an exec()uted process.

nginx doesn’t support perl natively anyway does it?

On Thu, Sep 11, 2008 at 12:35 AM, Kingsley F.

wait, perl module?

does that mean i can run perl-based .cgi and .pl scripts directly from
nginx? i didn’t think this was supported?

Does this behaviour change, if you use “nohup sleep 200…”?

On Thu, Sep 11, 2008 at 12:47:39AM -0700, mike wrote:

wait, perl module?

Yes, perl module:

http://wiki.codemongers.com/NginxEmbeddedPerlModule

does that mean i can run perl-based .cgi and .pl scripts directly from
nginx? i didn’t think this was supported?

This is possible, but not recommended.

Ive taken the easy way out, fastcgi and php :slight_smile:


From: “mike” [email protected]
Sent: Friday, September 12, 2008 12:57 AM
To: [email protected]
Subject: Re: executing a background script from embedded perl

On Thu, Sep 11, 2008 at 2:52 AM, Igor S. [email protected] wrote:

does that mean i can run perl-based .cgi and .pl scripts directly from
nginx? i didn’t think this was supported?

This is possible, but not recommended.

Yes, the more I looked at that it looked like I was wrong. It’s for
embedded perl, not really for sending requests to CGI scripts.

Right now I’m having to proxy to apache on the same machine
(localhost:81) (I was using thttpd but it kept crashing and I needed a
little bit more functionality) - it’s sad I have to include something
else in the mix, I just wish we could get everything switched to
something that can be proxied to more natively - fastcgi (php) or
mongrels or something. supporting these older CGI packages is
annoying!

On Thu, Sep 11, 2008 at 8:47 AM, Igor S. [email protected] wrote:

Have you tried mini_httpd http://acme.com/software/mini_httpd/ ?
Or you need more functionality ?

no i haven’t, i only tried thttpd. i can’t really change it now and
it’s a low traffic site, so apache is okay. i wish someone would
rewrite bugzilla in PHP (or get a product close enough that people
will switch) finally so it wasn’t such a pain to support.

On Thu, Sep 11, 2008 at 08:27:55AM -0700, mike wrote:

Right now I’m having to proxy to apache on the same machine
(localhost:81) (I was using thttpd but it kept crashing and I needed a
little bit more functionality) - it’s sad I have to include something
else in the mix, I just wish we could get everything switched to
something that can be proxied to more natively - fastcgi (php) or
mongrels or something. supporting these older CGI packages is
annoying!

Have you tried mini_httpd http://acme.com/software/mini_httpd/ ?
Or you need more functionality ?

trust me, that’s what i try to get everything to use…

On Thu, Sep 11, 2008 at 8:48 AM, Kingsley F.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs