I have a systemd defined service, that cannot be restarted using systemctl unless I first do a stop. Systemctl claims that the unit does not exists. This happens everytime I reboot until I execute systemctl stop. How can I ensure that the service can be correctly restarted without first having to call systemctl stop?
Example:
# systemctl restart merlind.service
Failed to restart merlind.service: Unit not found.
# systemctl stop merlind.service
# systemctl restart merlind.service
Systemd service definition:
[Unit]
Description=Merlin
After=network.target
[Service]
ExecStart=/usr/bin/merlind --config /path/to/conf --debug
ExecStop=/usr/bin/merlind --config /path/to/conf --kill
Restart=always
[Install]
WantedBy=multi-user.target
The .service file is located at /usr/lib/systemd/system/ and symlinked at: /etc/systemd/system/multi-user.target.wants/
CentOS Linux release 7.5.1804 (Core)
Systemd version: 219
.wantsdirectory? That's not how systemd unit files are supposed to work. It should be in/etc/systemd/systemand symlinked into the.wantsdirectory. And better yet would be to use the tools such assystemctl enable.restart merlindinstead ofrestart merlind.service