Welcome! Log In Create A New Profile

Advanced

Re: monitor file

October 27, 2017 12:26AM
Thanks for the quick response. This is exactly what I need. Yes, it is a
NGX_HTTP_MODULE.
How do I ensure, "this module is behind ngx_event_core_module"? Thanks.

Dk


On Thu, Oct 26, 2017 at 9:12 PM, 胡聪 (hucc) <hucong.c@foxmail.com> wrote:

> Hi,
>
> On Friday, Oct 27, 2017 5:04 AM, Dk Jack wrote:
>
> >In my module I'd like to monitor the creation of a file (at a specific)
> using
> >inotify or something similar and load some data from the file. How would
> I go
> >about hooking up the inotifyFd with the nginx event system so that I get a
> >callback when the file is created on the disk?
>
> First of all, please make sure that this module is behind
> ngx_event_core_module.
> Here, we asume the module type is NGX_HTTP_MODULE.
>
> Secondly, get some configuration information.
>
> Thirdly, module.init_process needs to be implemented.
> And here are the outline of init_process:
> if (ngx_worker == 0) {
> fd = inotify_init1(flags);
> wd = inotify_add_watch(fd, pathname, mask);
> c = ngx_get_connection(fd, log);
> rev = c->read;
> ...;
> rev->handler = your_main_callback_handler; /* What you want to do */
> ngx_add_event(rev, NGX_READ_EVENT, 0);
> }
>
> Hope this helps!
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

monitor file

dnj0496 1012 October 26, 2017 05:06PM

Re: monitor file

胡聪 (hucc) 410 October 27, 2017 12:14AM

Re: monitor file

dnj0496 630 October 27, 2017 12:26AM

Re: monitor file

胡聪 (hucc) 455 October 27, 2017 01:20AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 328
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready