コンテンツにスキップ

JupyterのService化

Systemd

/etc/sysyemd/system以下に、jupyter.serviceを作成する。

/etc/sysyemd/system/jupyter.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
[Unit]
Description = Jupyter Notebook

[Service]
PIDFile=/var/run/jupyter.pid
ExecStart=/usr/local/bin/jupyter-notebook --ip= --config=/home/pi/.jupyter/jupyter_notebook_config.py
User=pi
Group=pi
Restart=always
RestartSec=10
WorkingDirectory=/home/pi/Documents
Type=simple

[Install]
WantedBy=multi-user.target

設定の確認

1
2
$ systemctl list-unit-files --type=service | grep jupyter
jupyter.service       invalid

Serviceの起動

1
$ sudo systemctl enable jupyter