Running tensorflow as daemon and piping all output to log file
<p>To run tensorflow model as daemon I use : </p>

<pre><code>nohup python translate.py --data_dir data &amp;
</code></pre>

<p>This logs error messages to nohup.out but it does not capture Tensorflow stdout . This thread offers describes related : <a href="https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/SO_JRts-VIs" rel="nofollow">https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/SO_JRts-VIs</a> but does not provide solution.</p>

<p>I require to run as daemon as model takes quite some time to run. This is to prevent ssh disconnecting due to inactivity.</p>

<p>How to run Tensorflow as daemon process and pipe all output to file ?</p>

<p>Why not try </p>

<pre><code>nohup python translate.py --data_dir data &amp;&gt; outputfile.txt
</code></pre>

<p>You can then suspend the file your self with kill -19 %1 to suspend the first job or whatever number its present as. Then kill -CONT %1 to restart it. </p>

<p>Other options:</p>

<ul>
<li>"disown" command </li>
<li>tmux (as suggested in the comments)</li>
<li>screen (similar to tmux)</li>
<li>using mosh instead of ssh</li>
<li>save the outputs from within the file translate.py instead of printing to stdout</li>
</ul>

python linux tensorflow