[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to run in background through forking in Lua?
- From: Steve Litt <slitt@...>
- Date: Mon, 3 Jan 2011 10:07:23 -0500
On Monday 03 January 2011 09:46:48 Axel Kittenberger wrote:
> Just to add, a well behaved daemon should change its working dir to
> "/" and redirect stdin/out/err to /dev/null.
This wouldn't be a daemon, and maybe the word "background" was the wrong way
to describe it. What happens is UMENU runs, let's say kmail, and then UMENU
continues executing at the same time kmail executes. So you can interact with
kmail and/or UMENU -- they're two different active windows.
>
> Also if you have an open file descriptor at this point (does Lua
> have?), then you should check if its <= 2 before redirecting
> stdin/out/err, since when true you were started by a consoleless
> daemon already and you might close your fds.
The Perl code has been running correctly for 10 years without closing file
descriptors, so it's probably going to be just fine.
>
> Either do it in C or use luaposix or alien.
I'll probably do it in C so I can give the user a precompiled binary. For the
time being, while I'm getting the Lua UMENU working, I'll just temporary use
ufork.pl :-)
Thanks
SteveT
Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt