title: Running Jupyter Notebook in the background on remote server, get output
body: <p>I am trying to run a Jupyter Notebook in the background. I found <a href="https://stackoverflow.com/questions/34865097/run-jupyter-notebook-in-the-background-on-docker">this question</a> that included the command</p>
  
  <pre><code>jupyter notebook &amp;&gt; /dev/null &amp;
  </code></pre>
  
  <p>which worked on my local machine. However, I have two problems:</p>
  
  <ol>
  <li><p>I need a token in order to be able to access my notebooks in a browser window. However, with the above command, there is no output into the Terminal window except for the process ID, and therefore I could not access my notebooks.</p></li>
  <li><p>I also need to run the notebook in the background on a remote machine. I <code>ssh</code> into the remote machine, and then run <code>jupyter notebook --no-browser</code>. However, once I close my laptop, the notebook process is killed in my local Terminal window, as well as the <code>ssh</code>.</p></li>
  </ol>
  
  <p>I was able to crudely circumvent the above problems by running the normal</p>
  
  <pre><code>jupyter notebook --no-browser
  </code></pre>
  
  <p>in the remote server, and then killing the <code>ssh</code> to the remote server. My question boils down to the following two sub-questions:</p>
  
  <ol>
  <li><p>Is there any way of doing this besides closing the <code>ssh</code>? I guess this isn't really the biggest problem, but it seems very hacky to simply kill the ssh instead of some more elegant or more effective solution.</p></li>
  <li><p>How would I achieve the same thing on my local machine? I need to run the Jupyter Notebook in the background while also somehow getting the output. Can I direct the output into another file or read it somewhere else?</p></li>
  </ol>