---
title: "Linux添加service服务文件"
url: "https://versun.me/linux-systemd-service-file"
markdown_url: "https://versun.me/linux-systemd-service-file.md"
format: "note"
published: "2019-04-19T00:00:00.000Z"
updated: "2026-01-05T05:31:55.000Z"
collections:
  - "Blog"
site: "Versun"
---

# Linux添加service服务文件

vim /lib/systemd/system/jupyter.service /  
这个目录不同发行版可能也不同

```
[Unit]
Description=jupyter
After=network.target
[Service]
Tpye=forking
EnvironmentFile=/usr/local/bin/jupyter-notebook
ExecStart=/usr/local/bin/jupyter-notebook
ExecStop=/usr/bin/pkill jupyter-notebook
KillMode=process
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target
```

创建好之后再操作下就行了  
`bash systemctl daemon-reload systemctl start jupyter systemctl enable jupyter`
