Java Mailing List Archive

http://www.redhatconfig.com/

Home » Mandriva Cooker »

Re: [Cooker] initscript : no --background for daemon() ?

Michael Scherer

2008-07-07

Replies: Find Java Web Hosting

Author LoginPost Reply

Le 7 juil. 08 à 19:15, Vincent Panel a écrit :

> On Mon, Jul 7, 2008 at 7:09 PM, Fabrice Facorat
> <fabrice.facorat@(protected):
>> 2008/7/7 Vincent Panel <yohonet@(protected)>:
>>> Hi,
>>>
>>> I'm trying to create an initscript for a specific program, but found
>>> out the program doesn't have any option to stay in the background. I
>>> thought there was such an option for the daemon function used in
>>> initscripts, but it seems it doesn't exist. So I tried to put a
>>> "&" at
>>> the end the program's name in the script without much success.
>>>
>>> Has any of you already created such an initscript (with a program
>>> non
>>> forking into the background) ? what did you you do in this case ?
>>
>> Indeed you are right.
>> In this case, you won't be able to use daemon function, and you will
>> have to create manually the startup fo the program and add & at the
>> end :(
>
> Actually, I solved the problem by rewriting the daemon function,
> accepting a new option "--bg" and when this option is provided, I add
> an "&" inside the daemon function. I wish this option existed by
> default for daemon, programs not forking that you'd like to run as
> daemons are not so unusual.

Becoming a daemon requires more than using &
( and no, i am not talking about virgin sacrifice under the full moon )

See :
http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html

So, it is better to patch the software, IMHO.

--
Michael Scherer




©2008 redhatconfig.com - Jax Systems, LLC, U.S.A.