troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
622 stars 61 forks source link

Allow + or - to action only on condition set or unset #330

Open hongkongkiwi opened 1 year ago

hongkongkiwi commented 1 year ago

I'd really like the option to link conditions so that they only trigger when the condition comes up, but not when it goes down.

Currently I have 3 things running as plugins, dbus, chrony & qmi-proxy. These need to be run early for various reasons.

I'd love to be able to link other services to these without having them take down the other services.

For example, I'd like to link the condition so that mdevd starts after chrony, but if chrony goes down, I don't want mdevd to be taken down because of it.

I wanted to propose a + or - character, such that + means that the condition only operates when it's set and - means it only triggers when it's not set. No operator means it triggers the service when it's up or down.

To me this feels like a nice extension and is backwards compatible but could provide a lot of flexibility.

What do you think? With this, I think I could stop using plugins for starting services completely.

Another example could be klogd and syslogd. E.g. I want my service to start after syslog starts, but if syslog dies or gets restarted I don't want my critical service to die.

hongkongkiwi commented 1 year ago

I think we have discussed it in #21 but that is a separate item. I wanted to add an issue for this as it would be incredibly useful for me and a powerful feature I think.

troglobit commented 1 year ago

It's a good suggestion, and I understand the use-case even though >90% of our own cases have had the reverse requirement (to actually ensure mdevd be taken down if chrony goes down), which is the reason for why it's designed this way.

Adapting Finit to your suggestion is a HUGE amount of work to the internals and I don't see us implementing this any time soon.

az143 commented 8 months ago

how i achieve (more or less exactly) this behaviour with user conditions and no changes to finit is described in #264.