title: Java : Running shell script in background
body: <p>Im trying to run a shell script in the background that does not terminate when my function/process end. However it seems that despite nohup, when the java thread ends. So does the script.</p>
  
  <p>Below is sample code.</p>
  
  <pre><code>///
  /// Tries to run a script in the background
  ///
  try {
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("nohup sh ./runner.sh &gt; output.txt &amp;", new String[] {}, wrkDir);
      // pr.waitFor(); // Intentionally not using
  } catch(Exception e) {
      throw new RuntimeException(e);
  }
  </code></pre>