I connect to a remote server using ssh -L
but if I close the laptop lid or the connection is lost, the jupyter notebook is disconnected.
After I reconnect to the remote server, the "last" session is lost.
What can be done to make it persistent? Could screen
help with it?
you can run jupyter notebook --no-browser --ip="<remote server ip>" on your remote machine terminal. And access notebooks using http://:8888/?token=<> from your browser on local machine.
How do I schedule a Jupyter Notebook to run? When your Jupyter notebook is ready for scheduling, open the Schedule runs option inside the Computation tab or access it from the Run menu in Datalore. Then choose the run interval (hourly, daily, weekly, monthly) and the time zone.
Open a Jupyter notebook from the left sidebar. Click on the Scheduler icon either from the left sidebar tab or from the top toolbar of the Jupyter notebook. The left sidebar displays the Schedule(s) and Run History tabs as shown below. To view the active schedules, click Schedule(s) tab.
On the remote server, you should open your jupyter in a screen
session, it will make it persistent if you lose the connection to the server and resume it.
ssh -L xxxx:localhost:yyyy server
.screen
.jupyter notebook --no-browser --port=yyyy
. [on remote server]localhost:xxxx
.To disconnect manually and reconnect:
control + a
and then d
.control + d
ssh -L xxxx:localhost:yyyy
.screen -r
.localhost:xxxx
.The standard usage for persisting Jupyter server sessions is the use of nohup
and &
; in your remote server with IP address xx.xx.xx.xx
:
nohup jupyter notebook --no-browser --ip xx.xx.xx.xx --port yyyy &
Now, even if you switch off your laptop or lose the connection, you will be always able to reconnect by pointing your browser at xx.xx.xx.xx:yyyy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With