I really need some help working out service dependencies in systemd. If anybody's got some time to answer a few questions, could you help me out?

@drwho

I think the pattern is After= and Requires=, not After= and Wants= ?

@drwho
Wants= is a very soft statement compared to requires:

Wants=

A weaker version of Requires=. Units listed in this option will be started if the configuring unit is. However, if the listed units fail to start or cannot be added to the transaction, this has no impact on the validity of the transaction as a whole. This is the recommended way to hook start-up of one unit to the start-up of another unit.

@drwho

Also, I just recalled this. The simple service type doesn't understand that your service has a startup time.

You can force a wait in your [Service] section for dependent units to cheaply work around this for now:

ExecStartPre=/bin/sleep 5

@endomain Hmmm... I can't necessarily predict how long it'll take for the message bus to come online due to my home link.

I just scanned through my code and didn't find any "bot can't reach message queue so it dies" code.

Is there a service type that does have a concept of a startup time?

Follow

@drwho

Just to be complete: there is a notify type. You found it. Otherwise people use shell commands that block. For example if you write a pidfile you can shellloop on that pidfile containing a value.

@endomain Hmmm... that would require a bit more addition of code to the XMPP bridge. I think I'll try sd_notify first, and fall back on that if it's less stable.

Sign in to participate in the conversation
hackers.town

A bunch of technomancers in the fediverse. Keep it fairly clean please. This arcology is for all who wash up upon it's digital shore.