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

Follow

@endomain What about actually supporting the notify service type? I could add this to the message bus...

github.com/bb4242/sdnotify

@drwho

You could. Or you could be lazy and use a static service type. I use the notify type in production when it's well supported by my runtime. Otherwise it's just one more potential bug.

@endomain It wound up being way easier to just fix my code. I was doing some dumb stuff in the initialization phase, but doing it right in the runloop.

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.