Notebook: Checking by command line if Jupyter server is running

Created on 6 Dec 2016  路  9Comments  路  Source: jupyter/notebook

Sometimes we launched Jupyter and we crash it.
It would be good to have a command line to list of Jupyter kernel running like :
jupyter listall

It can be checked by checking the name 'jupyter' in the process list and terminate it by :
jupyter terminate id / all

Server Enhancement

Most helpful comment

There is a jupyter notebook list command for listing running notebooks. There isn't a corresponding terminate, though.

All 9 comments

nbmanager is similar to what you want. It provides a GUI rather than a command line interface, but the module nbmanager.api is general purpose and could be reused to make command line UI.

sometimes, we manage Jupyter through SSH on remote server..... no GUI

There is a jupyter notebook list command for listing running notebooks. There isn't a corresponding terminate, though.

@arita37 Taken from here:

https://stackoverflow.com/a/32745046/3576984

For an SSH'd terminal, we can just run:

kill $(pgrep jupyter)

To kill terminals that we can't CTRL+C.

There is also now a jupyter notebook stop command that takes a port number and shuts down the corresponding notebook server.

From 5.1, you will also be able to shut a server down if you have HTTP access to it by making a POST request to /api/shutdown.

@takluyver Is jupyter notebook stop available in 5.0.0? I get a No such file or directory error:

$ jupyter notebook --version
5.0.0
$ jupyter notebook stop 8888
[C 10:02:38.220 NotebookApp] No such file or directory: /Users/jjpr/stop

Oops, sorry. It's new in 5.1, added by #2388.

There is a jupyter notebook list command for listing running notebooks. There isn't a corresponding terminate, though.

This is giving parser error to me, any suggestions?

asen@asen-5356:~$ jupyter notebook list Traceback (most recent call last): File "/opt/conda/bin/jupyter-notebook", line 11, in <module> sys.exit(main()) File "/opt/conda/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File "/opt/conda/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance app.start() File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 1571, in start super(NotebookApp, self).start() File "/opt/conda/lib/python3.6/site-packages/jupyter_core/application.py", line 255, in start self.subapp.start() File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 483, in start serverinfo_list = list(list_running_servers(self.runtime_dir)) File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 1667, in list_running_servers info = json.load(f) File "/opt/conda/lib/python3.6/json/__init__.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/opt/conda/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/opt/conda/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/conda/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

Same issue as mentioned above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uolter picture uolter  路  3Comments

harshinielath picture harshinielath  路  3Comments

jonatanblue picture jonatanblue  路  3Comments

mikepqr picture mikepqr  路  3Comments

pylang picture pylang  路  3Comments