2
私の関数/プロセスが終了したときに終了しないバックグラウンドでシェルスクリプトを実行しようとしています。しかし、それはnohupにもかかわらず、Javaスレッドが終了すると思われる。スクリプトもそうです。Java:バックグラウンドでのシェルスクリプトの実行
以下はサンプルコードです。
///
/// Tries to run a script in the background
///
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("nohup sh ./runner.sh > output.txt &", new String[] {}, wrkDir);
// pr.waitFor(); // Intentionally not using
} catch(Exception e) {
throw new RuntimeException(e);
}