I’ve created this service in /etc/systemd/system/webapp.service
in a
Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10
This is the content:
[Unit] Description=webapp daemon After=network.target [Service] Type=notify ExecStart=/usr/local/bin/start-webapp.sh ExecStop=/usr/local/bin/stop-webapp.sh ExecReload=/usr/local/bin/reload-webapp.sh StandardOutput=null [Install] WantedBy=multi-user.target Alias=webapp.service
I try to startd the service using:
sudo systemctl start webapp.service
But when I do
sudo systemctl status webapp.service
I got this error:
● 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 '='.
and
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$
Advertisement
Answer
Your config content seems nothing wrong, so I have copied it to my debian server and try to run it, and it’s really ok.
But it’s strange that the stdout of cat -vetn webapp.service is not the exactly content of your original config, so would you mind to remove the original config and do it again ?
refer: https://wiki.debian.org/systemd/Services
redo:
mv webapp.service /tmp/webapp.service vi webapp.service # check charactersAfter creating or modifying any unit files, we must tell systemd that we want it to look for new things:
systemctl daemon-reloadThen, tell systemd to enable it, so that it will start every time we boot:
systemctl enable myservice.serviceFinally, start it:
systemctl start myservice.service