On Fri, 25 Sep 1998, Paul Brown wrote:

> Hi all,
> 
> a relatively simple question:
> 
> I am just about fnished writing a daemon, and would like to know how i
> can make the program fork into
> the background automatically..
> 
> ie, instead of this:
> 
> #> ./daemon &
> #>
> 
> i would like this:
> 
> #> ./daemon
> #>
> 
> Although it is written in perl i am sure the theory is the same...
> 
> thanks for any help you have to offer
> 
> cheers
> paul
> 
in C:

main(){
close(0); // it is good but not required
if(fork()) exit(0); // father process will exit and leave child to run
// your code here
};



------------------------------------------------------------------------------
        Best wishes,
                Marcel - Titus MARGINEAN
                [EMAIL PROTECTED], [EMAIL PROTECTED]

Reply via email to