← Back to context

Comment by ww520

1 year ago

Having different semantics with different proprieties on the same command is really confusing.

I would argue the semantics of ExecStop are always the same. It's the command that's executed to stop the service. On the other hand, what it means for a service to be "running" or "stopping" naturally depends on what type of service it is (i.e., is it a daemon or not?)

  • > the command that's executed to stop the service

    That’s what is assumed. But in reality it runs after the started process stops.

    • Yes, so whether the service is stopping as a result of the process exiting, or whether you requested the service to stop manually, it will run the ExecStop in either case.

      That makes sense to me personally. What would be the more intuitive design in your mind?

      4 replies →

Think of it as an enum, Type branches the logic.

    enum Service {
        Exec { ExecStart: String, ... }
        Forking { ExecStart: String, ... }
        OneShot { ExecStart: String, ... }
    }

You can argue that sometimes that ExecStart could be a different term, but it'd still end up being the same across multiple enum variants.

  • Yes. ExecStart works the same for all the cases. ExecStop works differently though. While ExecStart is the event to kick off the command for the service, ExecStop is not. The asymmetric semantics are where the confusion comes from.