News for hackers. Stuff that matters.
Re:Systemd v227 by simoncion on Thursday October 08, 2015 @08:40PM (#10357379)
But, that's kinda the thing...

Folks gush about how concise systemd unit files are.

For services that require no complicated pre-start checks or configuration, equivalent service start scripts are more concise and just as legible in either OpenRC or -AIUI- Upstart. (Look at my conversion of a simple systemd unit file [0] to an OpenRC init script. [1])

What's more, for jobs that need complicated pre-start logic of one kind or another -AIUI- systemd provides no way to bundle that logic with your service description file. You have to put that logic in another script file which is then called by systemd.

EDIT: I can't speak to Upstart, but even if your service has dependencies or needs to be started before or after some other service or class of service, [2] specifying them is similarly concise and legible. Add

  depend() {
   use some_optional_service
   need some_requred_service
   before some_service_or_service_class
   after some_other_service_or_srv_class
  }
somewhere near the top of your script. For most services, this adds three non-whitespace lines. :)

[0] https://news.ycombinator.com/item?id=10355588

[1] https://news.ycombinator.com/item?id=10357010

[2] For example: The network start scripts provide the "net" service. You might have a service that -for some reason- needs to start before or after the "net" service, but doesn't actually depend on it to start. This is what "before" and "after" are used for.

There are no comments on this comment yet.