This is helpful when running jupyter notebook on remote server (AWS) and tunneling into it, because with nohup the notebook process continues to run on the server even if you get disconnected from it (any running notebook code continues to run on the server without interruption, and just needs to be re-tunneled into).
In the remote server terminal, run:
nohup jupyter notebook &
(the & sends the process to run in the background, so that the terminal window can be used)
In the local terminal, run:
ssh awsgpu -NL 8157:localhost:8888 [email protected]
replacing awsgpu
with remote server ssh login,
8157
with a free local port,
8888
with the port used by jupyter notebook on the remote server (usually it's 8888),
and 11.111.111.11
with remote server IP.
Since we now have a jupyter notebook running in the background, we can't stop the notebook
by closing the terminal window or Ctrl C
. Here are the steps to stop it.
- check what jupyter notebooks are running:
jupyter notebook list
(note which ports are being used)
- find which process IDs (PIDs) are being run on the port used by the jupyter notebook(s):
netstat -tulpn
Look for processes that are running on port 8888 (or whichever port was listed in the step above), and note the PID.
- now kill the process(es):
kill 2759
replace 2759
with the PID from the step above.
what if I wanna run "jupyter notebook --ip=0.0.0.0 --NotebookApp.token='' --NotebookApp.password=''"