1

I'm developing a daemon that runs under control of systemd, and that has a feature to reload code that's inbetween "systemctl reload" and "systemctl restart". Unlike "systemctl reload" that sends a signal to re-read just the configuration, it also reloads the code, but unlike "systemctl restart" it's not a true hard restart that forgets all the state, but instead the state is written to a file and a signal causes the daemon to replace its code with execve() and then it reads the old state from the file.

Is there any feature in systemd that would allow me to add some custom command to systemctl that would be inbetween reload and restart, just for this daemon?

Technically the feature would be implemented by some signal such as SIGUSR1 or SIGUSR2.

I'm expecting that there could be cases where a hard restart will be done instead of the lighterweight "dump state + execve + reload state", so it would be useful to have the hard restart command in existence too.

1 Answer 1

1

No, there is no way to add custom verbs without modifying the systemctl source. Unless you need to distinguish between three ways to refresh your service you can set ExecReload to do whatever is necessary. Otherwise if sending signal is enough you can simply use systemctl kill to send the custom signal to the process(es) of your service.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.