lua-users home
lua-l archive

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



On 8-Feb-07, at 8:23 PM, gary ng wrote:

The way I know of doing it is to double fork then dup2
the stdin/stdout/stderr handles.

I can find fork() in the posix package but don't know
how to dup2 and/or get the fileno() of io.stdin etc.

Or I need some other helper say using python to
daemonize then spawn the lua script ?


I personally find djb's daemontools quite easy to use for applications like that. See http://cr.yp.to/daemontools.html

If you want to do tcp servers, see tcpserver and tcpclient here: http://cr.yp.to/ucspi-tcp.html