I have two Spring applications that chug along nicely, nothing special happening, and then out of the blue the applications restart; journalctl shows these lines:
Jan 15 04:43:11 nyota.softworks.nl systemd[1]: Stopping calendaraggregator.service...
Jan 15 04:43:11 nyota.softworks.nl systemd[1]: calendaraggregator.service: Deactivated successfully.
Jan 15 04:43:11 nyota.softworks.nl systemd[1]: Stopped calendaraggregator.service.
Jan 15 04:43:11 nyota.softworks.nl systemd[1]: calendaraggregator.service: Consumed 3min 313ms CPU time.
Jan 15 04:43:11 nyota.softworks.nl systemd[1]: Started calendaraggregator.service.
Jan 15 10:41:43 nyota.softworks.nl systemd[1]: Stopping calendaraggregator.service...
Jan 15 10:41:43 nyota.softworks.nl systemd[1]: calendaraggregator.service: Deactivated successfully.
Jan 15 10:41:43 nyota.softworks.nl systemd[1]: Stopped calendaraggregator.service.
Jan 15 10:41:43 nyota.softworks.nl systemd[1]: calendaraggregator.service: Consumed 1min 48.505s CPU time.
Jan 15 10:41:43 nyota.softworks.nl systemd[1]: Started calendaraggregator.service.
Jan 15 18:17:17 nyota.softworks.nl systemd[1]: Stopping calendaraggregator.service...
Jan 15 18:17:17 nyota.softworks.nl systemd[1]: calendaraggregator.service: Deactivated successfully.
Jan 15 18:17:17 nyota.softworks.nl systemd[1]: Stopped calendaraggregator.service.
Jan 15 18:17:17 nyota.softworks.nl systemd[1]: calendaraggregator.service: Consumed 2min 24.748s CPU time.
Jan 15 18:17:17 nyota.softworks.nl systemd[1]: Started calendaraggregator.service.
But the systemctl configuration AFAIK does not do a restart, not even after failure (took that out to debug this).
[Service]
WorkingDirectory=/home/calendaraggregator/
User=calendaraggregator
Group=calendaraggregator
ExecStart=/bin/bash /home/calendaraggregator/run.sh
Is there anyway to see what triggered the shutdown?
The log of the application is not of much use, it only says INFO org.springframework.core.log.CompositeLog [SpringApplicationShutdownHook] Stopping.
without any reason / exception. Also, the application is restarted externally, since the main is called again (I logged that) and AFAIK I do not have systemd configured to restart.
Update 2024-05-06
I've rewritten one of the applications from Spring to Quarkus, to exclude the framework being a factor. I've moved the system configuration from /etc to ~/.config. But the applications keep restarting.
Interestingly, even though the applications are now configured under separate users, each with its ~/.config/systemd/user/service file, they keep restarting all at exactly the same time! So there must be some system level factor triggering the restart.
journalctl
's output ... is that all there is, or did you filter out just messages pertaining to your service?