mmctrl.service
我有一个包含以下内容的服务文件
[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
运行 daemon-reload 并启动服务后,日志会反复显示此信息。
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.
没有错误。我/home/mm/.ctrlenv/bin/mmctrl --start
直接运行它就没问题。为什么这个服务总是不断尝试启动然后又一次次停用?