hauleth / erlang-systemd

systemd utilities for Erlang applications
Apache License 2.0
174 stars 19 forks source link

How to clear service status / send empty values? #26

Closed dumbbell closed 3 years ago

dumbbell commented 3 years ago

This is more a question than an issue at this stage.

Here, when a line is encoded before it is sent to systemd, variables with no data are dropped: https://github.com/hauleth/erlang-systemd/blob/0ce748edffcb72bb028733e9ca4707cb30add853/src/systemd_protocol.erl#L37-L41

The only way I found so far to clear the status of a service (using systemd:notify({status, Status})) is to set it to an empty string. Unfortunately, out-of-the-box, the value is dropped during encode. If I comment this string:is_empty() out, the status is correctly cleared according to "systemctl status $service".

Is it invalid to send empty values to systemd?

hauleth commented 3 years ago

I do not remember why I have done that. Send PR that removes this check and we will be ok.