Pythonで「Jupyter Notebookの起動と停止」の動作を確認してみた

# 概要

Pythonで「Jupyter Notebookの起動と停止」の動作を確認してみました。以下のページを参考にしました。

https://www.javadrive.jp/python/jupyter-notebook/index2.html

# 動作確認

Jupyter Notebookを起動しました。以下のコマンドを実行しました。
```
$ jupyter notebook
[I 2023-10-18 17:28:06.137 ServerApp] Package notebook took 0.0000s to import
[I 2023-10-18 17:28:06.156 ServerApp] Package jupyter_lsp took 0.0195s to import
[W 2023-10-18 17:28:06.157 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-10-18 17:28:06.182 ServerApp] Package jupyter_server_terminals took 0.0254s to import
[I 2023-10-18 17:28:06.183 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-10-18 17:28:08.890 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-10-18 17:28:08.890 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-10-18 17:28:08.902 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-10-18 17:28:08.906 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2023-10-18 17:28:08.910 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-10-18 17:28:08.914 ServerApp] notebook | extension was successfully linked.
[I 2023-10-18 17:28:08.928 ServerApp] Writing Jupyter server cookie secret to /home/kawasaki/.local/share/jupyter/runtime/jupyter_cookie_secret
[I 2023-10-18 17:28:10.660 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-10-18 17:28:10.749 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-10-18 17:28:10.753 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-10-18 17:28:10.755 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-10-18 17:28:10.757 LabApp] JupyterLab extension loaded from /home/kawasaki/.local/lib/python3.10/site-packages/jupyterlab
[I 2023-10-18 17:28:10.757 LabApp] JupyterLab application directory is /home/kawasaki/.local/share/jupyter/lab
[I 2023-10-18 17:28:10.758 LabApp] Extension Manager is 'pypi'.
[I 2023-10-18 17:28:10.762 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-10-18 17:28:10.764 ServerApp] notebook | extension was successfully loaded.
[I 2023-10-18 17:28:10.765 ServerApp] Serving notebooks from local directory: /home/kawasaki/projects/python3
[I 2023-10-18 17:28:10.765 ServerApp] Jupyter Server 2.8.0 is running at:
[I 2023-10-18 17:28:10.765 ServerApp] http://localhost:8888/tree?token=e3ae068351b4ec5ce4f9e2fb817d0937501ac376631fdf49
[I 2023-10-18 17:28:10.765 ServerApp]     http://127.0.0.1:8888/tree?token=e3ae068351b4ec5ce4f9e2fb817d0937501ac376631fdf49
[I 2023-10-18 17:28:10.765 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-10-18 17:28:10.825 ServerApp] 

    To access the server, open this file in a browser:
        file:///home/kawasaki/.local/share/jupyter/runtime/jpserver-34900-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=e3ae068351b4ec5ce4f9e2fb817d0937501ac376631fdf49
        http://127.0.0.1:8888/tree?token=e3ae068351b4ec5ce4f9e2fb817d0937501ac376631fdf49
[I 2023-10-18 17:28:13.637 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
```

以下の通り実行できました。
![Screenshot from 2023-10-18 17-28-59.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3192024/7907a20d-c9a8-e6d7-5c1e-85a9d854a96b.png)

Jupyter Notebookを停止しました。以下のコマンドを実行しました。
```
^C[I 2023-10-18 17:29:24.374 ServerApp] interrupted
[I 2023-10-18 17:29:24.374 ServerApp] Serving notebooks from local directory: /home/kawasaki/projects/python3
    0 active kernels
    Jupyter Server 2.8.0 is running at:
    http://localhost:8888/tree?token=e3ae068351b4ec5ce4f9e2fb817d0937501ac376631fdf49
        http://127.0.0.1:8888/tree?token=e3ae068351b4ec5ce4f9e2fb817d0937501ac376631fdf49
Shutdown this Jupyter server (y/[n])? y
[C 2023-10-18 17:29:27.854 ServerApp] Shutdown confirmed
[I 2023-10-18 17:29:27.855 ServerApp] Shutting down 5 extensions
```

# まとめ

何かの役に立てばと。