Ich versuche, ein Shell-Skript im Hintergrund auszuführen, das nicht endet, wenn meine Funktion/Prozess endet. Es scheint jedoch, dass trotz Nohup, wenn der Java-Thread endet. So auch das Skript.Java: Laufendes Shell-Skript im Hintergrund
Unten ist Beispielcode.
///
/// 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);
}