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
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
author and jackaroo
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 1925 times.
All times above are in ranch (not your local) time.
The current ranch time is Dec 15, 2018 21:02:58.