title: Multiple nohup process writing output to same file
body: <p>I want to run multiple background processes through <code>ssh</code>, aggregate all outputs and errors to the same file and redirect the logs to papertrail using <a href="https://github.com/papertrail/remote_syslog" rel="nofollow noreferrer">remote_syslog</a></p>
  
  <p>Following this <a href="https://stackoverflow.com/questions/29142/getting-ssh-to-execute-a-command-in-the-background-on-target-machine">answer</a> i execute a ruby script in background like this :</p>
  
  <pre><code>ssh deploy@xx.xx.xxx.xx 'cd path/to/my_app; nohup ruby my_script.rb &gt; log/script.log 2&gt; log/script.log &lt; /dev/null &amp;'
  </code></pre>
  
  <p>It works as long as i only run one script. If i run multiple scripts i only see the output of the first script in the log file.</p>
  
  <p>Can you explain what i'm doing wrong ? Or provide a better way to achieve this. Thanks !</p>
  
  <p>(the log file is in <code>path/to/my_app/log/script.log</code>)</p>
  
  <hr>
  
  <p><strong>Solution :</strong></p>
  
  <p>Thanks to devnull comment i solved it, it was so simple... The proper command is :</p>
  
  <pre><code>ssh deploy@xx.xx.xxx.xx 'cd path/to/my_app; nohup ruby my_script.rb &gt;&gt; log/script.log 2&gt;&gt; log/script.log &lt; /dev/null &amp;'
  </code></pre>