Running code in nginx's master process

Is it possible to have a module run code in nginx’s master process, i.e.
not
in a worker process?
I know init_master is just a stub for now. Are there any chances this
gets
implemented in the near future?

Thanks in advance,
Marcelo.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,243942,243942#msg-243942

Hello!

On Mon, Oct 21, 2013 at 08:27:01PM -0400, mzabani wrote:

Is it possible to have a module run code in nginx’s master process, i.e. not
in a worker process?
I know init_master is just a stub for now. Are there any chances this gets
implemented in the near future?

I wouldn’t recommend running a code in master process, but if you
have to for some reason, you may try using init_module callback.


Maxim D.
http://nginx.org/en/donation.html

It seems like the init_module callback is not executed in nginx’s master
process. At least, I’ve printed a call to getpid() and the pid returned
was
that of a process that wasn’t running, which makes me think it is
executed
in a process that forks the master process itself.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,243942,244069#msg-244069

Hello!

On Thu, Oct 24, 2013 at 08:37:03AM -0400, mzabani wrote:

It seems like the init_module callback is not executed in nginx’s master
process. At least, I’ve printed a call to getpid() and the pid returned was
that of a process that wasn’t running, which makes me think it is executed
in a process that forks the master process itself.

Yes, the init_module callback is called after configuration parsing,
and on initial startup this happens before demonization, hence
there is no master process yet. On reconfiguration it’s executed
in the master process itself.


Maxim D.
http://nginx.org/en/donation.html

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