lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wednesday 13, Alexander Gladysh wrote:
> On Wed, Apr 13, 2011 at 15:29, Louis Mamakos <louie@transsys.com> wrote:
> > On Apr 13, 2011, at 2:32 AM, Alexander Gladysh wrote:
> >> On Wed, Apr 13, 2011 at 03:58, Matthew Wild <mwild1@gmail.com> wrote:
> >>> On 13 April 2011 00:47, Alexander Gladysh <agladysh@gmail.com> wrote:
> >>>> On Sun, Apr 10, 2011 at 10:59, Alexander Gladysh <agladysh@gmail.com> 
wrote:
> >>>>> Now I rotated the log file. How do I tell the WSAPI service to let go
> >>>>> old log file and open a new one?
> > 
> > If you have lfs available, perhaps you could periodically stat() the log
> > file pathname, and see if it's major/minor device numbers changed?  That
> > would allow you to detect that it has been renamed and a new file at the
> > name has replaced it.
> 
> It will probably resolve the concrete problem with the log file, but
> will not help the problem in general. I do need to be able to send a
> message to a particular WSAPI fork and receive an immediate answer.

In that case how about having each WSAPI fork read from a named pipe (see 
mkfifo):
/tmp/wsapi_<pid>.pipe

You can send it a message/event by writing to that file.  You will need to 
make the FD non-blocking, since you wouldn't want to have the WSAPI process 
block on the read.

Basically your WSAPI process is going to have to listen for your command 
messages from somewhere.

Maybe it would help if you tell use a bit more about the types of 
events/messages that you need to send to your WSAPI process.  What time 
constraints are there on the processes response to those messages?  Does it 
need to interrupt the running script NOW or at a set of sync. points?

For the log file, it sounds like your are trying to make sure that 100% of the 
requests get logged to the log file.  If that is the case it might be better 
to have a log daemon collect the log messages from the WSAPI process over TCP, 
then you can have the log daemon handle the log rotation at a fixed interval 
or after it grows to a set size.

-- 
Robert G. Jakabosky