0

I have a service file mmctrl.service with the following contents

[Unit]
Description=MosquitoMax Controller Service
After=network.target

[Service]
User=mm
Group=mm
WorkingDirectory=/home/mm/
Environment=PATH=/home/mm/.ctrlenv/bin
ExecStart=/home/mm/.ctrlenv/bin/mmctrl --start
ExecReload=/bin/kill -s HUP $MAINPID
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

After running daemon-reload and starting the service, the logs show this over and over.

Dec 06 22:20:29 mmdwatrous systemd[1]: mmctrl.service: Scheduled restart job, restart counter is at 2.
Dec 06 22:20:29 mmdwatrous systemd[1]: Stopped mmctrl.service - MosquitoMax Controller Service.
Dec 06 22:20:29 mmdwatrous systemd[1]: mmctrl.service: Consumed 1.772s CPU time.
Dec 06 22:20:29 mmdwatrous systemd[1]: Started mmctrl.service - MosquitoMax Controller Service.
Dec 06 22:20:30 mmdwatrous sudo[1730]:       mm : PWD=/home/mm ; USER=root ; COMMAND=/usr/bin/systemctl status mmctrl.service
Dec 06 22:20:30 mmdwatrous sudo[1730]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1001)
Dec 06 22:20:30 mmdwatrous sudo[1730]: pam_unix(sudo:session): session closed for user root
Dec 06 22:20:31 mmdwatrous mmctrl[1729]: Log level: INFO
Dec 06 22:20:31 mmdwatrous mmctrl[1729]: Service running: True
Dec 06 22:20:31 mmdwatrous mmctrl[1729]: Controller is running. Use /usr/bin/systemctl.
Dec 06 22:20:31 mmdwatrous systemd[1]: mmctrl.service: Deactivated successfully.
Dec 06 22:20:31 mmdwatrous systemd[1]: mmctrl.service: Consumed 1.792s CPU time.

There are no errors. When I run /home/mm/.ctrlenv/bin/mmctrl --start directly it works fine. Why does this service keep trying to start and then deactivate over and over again?

2
  • First of all, increase your log level. It’s very likely that better indications of whatever issue you’re having will show up if you do that. But if it works when running the service manually you have a difference in environmental properties. Verify your file system permissions and secondarily verify whether the service actually runs with the expected configuration: does it use its config file? Does it expect environment variables not present in the running context?
    – Mikael H
    4 hours ago
  • You haven't specified a service Type= which possibly means that systemd makes an incorrect assumption about the run state of your service
    – HBruijn
    1 hour ago

0

You must log in to answer this question.

Browse other questions tagged .