systemd service failing to start upon reboot, somtimes
by Turbocapitalist from LinuxQuestions.org on (#5PQFK)
Sometimes systemd services fail to start after a reboot. For example, one system was powercycled unexpectedly due to a power hit and not being on UPS. Thus it had missed a graceful shutdown. When the system came back up, most of the services on it did too. However, one did not. There is nothing in the "logs" produced by the journalctl toy except an annotation of the most recent successful start. And there is nothing in syslog about it one way or another.
Here is the service file:
Code:[Unit]
Description=Foo publisher
After=mosquitto.service
[Service]
User=pi
Type=exec
ExecStart=/usr/local/bin/foo.py
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
RestartSec=10
RestartPreventExitStatus=255
[Install]
WantedBy=multi-user.targetI've gone through a lot of the example .service files and also looked at the service file documentation, also as man pages. I would think the above should work each and every boot, but although it frequently works, it has failed to start occasionally.
I've also tried
Code:Restart=on-failureWhat have I missed? I would like the service to start up each and every time the operating system boots, not just some of the times.
Here is the service file:
Code:[Unit]
Description=Foo publisher
After=mosquitto.service
[Service]
User=pi
Type=exec
ExecStart=/usr/local/bin/foo.py
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
RestartSec=10
RestartPreventExitStatus=255
[Install]
WantedBy=multi-user.targetI've gone through a lot of the example .service files and also looked at the service file documentation, also as man pages. I would think the above should work each and every boot, but although it frequently works, it has failed to start occasionally.
I've also tried
Code:Restart=on-failureWhat have I missed? I would like the service to start up each and every time the operating system boots, not just some of the times.