我已经在 /etc/systemd/system/webapp.service 中创建了此服务
在一个:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
这是内容:
[Unit]
Description=webapp daemon
[Service]
Type=simple
ExecStart=/usr/local/bin/start-webapp.sh
ExecStop=/usr/local/bin/stop-webapp.sh
ExecReload=/usr/local/bin/reload-webapp.sh
[Install]
WantedBy=multi-user.target
我尝试使用以下方式启动服务:
sudo systemctl start webapp.service
但当我这样做时
sudo systemctl status webapp.service
我收到这个错误:
● webapp.service - webapp daemon
Loaded: loaded (/etc/systemd/system/webapp.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Jun 01 11:31:48 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
Jun 01 11:31:52 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
Jun 01 11:35:21 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
Jun 01 11:35:31 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
和
admin@localhost:/etc/systemd/system$ cat -vetn webapp.service
1 [Unit]$
2 Description=webapp daemon$
3 [Service]$
4 Type=simple$
5 ExecStart=/usr/local/bin/start-webapp.sh$
6 ExecStop=/usr/local/bin/stop-webapp.sh$
7 ExecReload=/usr/local/bin/reload-webapp.sh$
8 [Install]$
9 WantedBy=multi-user.target$