Linux services does not start up in time after reboot
Symptom
In some environment, services are unable to start up in a timely fashion.
Environment
10.10;11.1;11;11.2;11.3;11.4;11.5;11.6;11.7;12.0;12.1;12.2;12.4;12.3;12.5;12.6 Privileged Access Manager (PAM, self-hosted) PSM
General
Cause
Generally this is usually related to the OS not loading the essential/required pre-req services in time.
Resolution
You can try to introducing a delay before the start of the service.
1.
==
You can run the sleep command before your ExecStart with ExecStartPre :
[Service]
ExecStartPre=/bin/sleep 60
The above will sleep for 60s before running the service start up. Executing the service start/restart command will also be affected.
==
2. Or to introduce a timer:
==
You can create a .timer systemd unit file to control the execution of your .service unit file.
So for example, to wait for 1 minute after boot-up before starting your foo.service, create a foo.timer file in the same directory with the contents:
[Timer]
OnBootSec=1min
It is important that the service is disabled (so it doesn't start at boot), and the timer enabled, for all this to work (thanks to user tride for this):
systemctl disable foo.service
systemctl enable foo.timer
Reference:
https://wiki.archlinux.org/title/Systemd/Timers
==