View Single Post

   
  #4 (permalink)  
Old 01-18-2008, 05:35 AM
Fritz Bayer
 
Posts: n/a
Default Re: Start scripts under linux

Lawrence DčOliveiro <ldo@geek-central.gen.new_zealand> wrote in message news:<ldo-40556C.19594808112004@lust.ihug.co.nz>...
> In article <Xns959AA26D0EEF5SunnySD@68.6.19.6>,
> "IANAL_VISTA" <IANAL_Vista@hotmail.com> wrote:
>
> >Some how I doubt the "su" is really required.
> >
> >FWIW - the line "java myprogram &" has the java process running "in the
> >backkground"; BUT it still depend upon its parent process to stay alive.
> >This is because the background process is a child process of its parent;
> >the process from which "java myprogram &" was issued. When the parent
> >process dies the child process gets terminated.
> >
> >The "nohup" (no hangup) instructs the OS to allow the process to stay alive
> >after the parent process terminates.

>
> Let me just add to this that most of the programs being run from init.d
> scripts make their own provisions for running detached from the
> invoker's terminal and process group, by using the fork(2) and setsid(2)
> system calls.
>
> If the original poster has access to the Java source code, it could
> probably be modified to do the same.


Thank you two for the replies. So I understand that the first problem
really arises from the parent child relationship.

Thanks to the second posting, I also understand now, why it's a
problem for my java program in particular and why most start scripts
in init.d using a & keep on running.

However, I'm not sure if it's possible to use a fork or something
alike in Java. I doubt it since java is os independent.

Anyway I was wondering whether or not their exists another solution to
my concurrency problem with the two start scripts.

Ok I could run a loop until the first one has started. But isn't it
possible to wait somehow until the program has started up...
Reply With Quote