it run in Unix
Runtime.getRuntime().exec() will create child process to excute shell script
and if I kill parent process, the child process will aslo exit
so, does any way to prevent child process exit???
However, this probably won't work if you kill the entire parent JVM, since that would kill all child threads. To avoid that, you'd probably need to launch a new OS process, not a new JVM process. These are some Unix system calls for that kind of stuff, but I'm not sure if pure Java can use them (I'm too lazy to RTFM). If not, however, you could always create a new shell process with a shell script that does it.
Post by:haifeng zhou
thanks all, I will try
Post by:Stefan Wagner
, Ranch Hand
Tim Holloway wrote:
Stefan Wagner wrote:Start it in a new Thread.
However, this probably won't work if you kill the entire parent JVM, since that would kill all child threads. To avoid that, you'd ...
To avoid that, you'd just not kill the parent JVM.
Post by:Andrew Monkhouse
, Marshal Commander
Personally I would have the Unix job started via a nohup process.
Note: I have not tried this, but I think it should work.
This thread has been viewed 1877 times.
All times above are in ranch (not your local) time.
The current ranch time is Sep 23, 2018 00:44:41.