title: nohup process stops running a few minutes after terminal closed
body: <p>I want a program (written in php) to run on a remote server even if after I logout. The program is very simple: it does nothing but sleep for 10s (just for a test), like the following:</p>
  
  <pre><code>function index() 
  {
      while(true)
      {
          sleep(10);
      }
  }
  </code></pre>
  
  <p>So I connect to the remote server via SSH. And then launch the program like this:</p>
  
  <pre><code>  nohup php -f index.php &amp;
  </code></pre>
  
  <p>I want it to run in the background on the server after I log out. But I find that everytime  after I close the terminal the program can only run for around 10 minutes and then stop, though it does not stop immediately after terminal closed. If I do not close the terminal, it can keep running forever (as expected). Could anyone tell me what is the reason? And how to solve the problem? I have also tried using "disown" as is suggested in this post but got the same problem: <a href="https://stackoverflow.com/questions/954302/how-to-make-a-programme-continue-to-run-after-log-out-from-ssh">How to make a programme continue to run after log out from ssh?</a>
  By the way, I am using shared remote host, so it could be due to some server settings but it's strange because it works fine with terminal open.</p>