Aliens

Systemd Daemon示例

April 3, 2021

1.新增service文件

vi /lib/systemd/system/jupyter-notebook.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[Unit]
Description=IPython notebook

[Service]
Type=simple
PIDFile=/var/run/ipython-notebook.pid
ExecStart=/home/xyz/.local/bin/anaconda/bin/jupyter-notebook --no-browser
User=xyz
Group=xyz
WorkingDirectory=/home/xyz/work/jupyter

[Install]
WantedBy=multi-user.target

2.开机启动

1
sudo systemctl enable jupyter-notebook.service

3.启动服务

1
sudo systemctl start jupyter-notebook.service

2,3两步可以合为一步sudo systemctl enable jupyter-notebook.service --now

https://stackoverflow.com/questions/14297741/how-to-start-ipython-notebook-server-at-boot-as-daemon