0

I created systemd service, which runs a script that auto-generates some configuration files if these don't exist, and loads the services depending on them, or loads the services with the existing ones.

I would like to provide some extra functionality, allowing the user to clean previous configurations using the same systemctl service.

I thought in ExecReload, thinking that it would be called when the user types systemctl restart service_name, but then I discovered that it is not doing what I thought.

Is there a way to do i? I was checking here and in Freedesktop Systemd doc, but I could not find the way

3
  • The trouble is that you're limited to systemctl's interface, which means verbs like start, stop, or reload, which you probably don't want to overload. Are you open to using something besides systemctl as the interface to this?
    – Jeff Schaller
    Commented Feb 22, 2019 at 12:57
  • yes, thank you: finally I created a script in /sbin to clean, re-build the configuration and reload the service
    – xCovelus
    Commented Feb 22, 2019 at 13:14
  • The command in ExecReload= is executed when you run systemctl reload, not restart (which does srop followed by start.) I guess it's not completely clear to me what you're trying to accomplish, would you care to give more details, like a more detailed description of what config files you want to generate and which services you want to start/restart/reload from your custom service? That would help us give you a better suggestion on how to accomplish what you're trying to do... Thanks!
    – filbranden
    Commented Feb 23, 2019 at 7:23

1 Answer 1

1

The trouble is that you're limited to systemctl's interface, which means verbs like start, stop, or reload, which you probably don't want to overload. My suggestion would be to use a separate interface altogether, such as a kill -USR1 signal handler or a separate script that you can invoke.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .