I have created a SystemD unit to start a service, and that service requires another unit to start beforehand.
I've set the depending service with
Requires=dependant.service, and that way when
depending.service is automatically started during boot, it first tries to start
The problem is that if
dependant.service starts too early, it fails to start (I'm not really sure what "too early" here means). To solve this, I've set
And that works fine -
depending.service is enabled and starts automatically, it starts
dependant.service, which crashes and then gets restarted and always succeeds to start on the 2nd try.
depending.service have seen
dependant.service's first failure and its
Requires=dependant.service causes it to fail. The log shows:
systemd: Dependency failed for depending. systemd: Job depending.service/start failed with result 'dependency'.
dependant has eventually succeeded, and both have
depending never restarts after the initial failure of
I've tried various configuration of
After but didn't manage to find a combination that causes
depending to restart after