AirVantage / sbulb

UDP load balancer prototype using bcc (XDP/Bpf)
36 stars 9 forks source link

Notify systemd when sbulb is ready #27 #28

Closed oliwer closed 4 years ago

oliwer commented 4 years ago

I am using suprocess.call() to be backward-compatible with python 2.

sbernard31 commented 4 years ago
  1. Maybe we can launch it only if sbulb is launched by systemd ? (using https://serverfault.com/a/927481)

  2. Currently the input/output/error pipes of systemd-notify --ready is connect to sbulb process. Do we really want this ? If not we could use DEVNULL.

  3. Should we check if file systemd-notify exists before to run with somethink like shutil.which?

oliwer commented 4 years ago
  1. Good idea. I'll look for $INVOCATION_ID.
  2. Yes, I want to see any error message raised by systemd-notify.
  3. That is useless. If the binary is not present, it will just fail silently.
sbernard31 commented 4 years ago
  1. that is useless. If the binary is not present, it will just fail silently.

The only reason I could see would be that we keep stderr connected and we launch systemd-notify only if "systemd is used" AND "systemd-notify is present&executable". So this way we see an output error only if systemd-notify failed unexpectedly :thinking:

oliwer commented 4 years ago

I'm going to use the environment variable $NOTIFY_SOCKET instead of $INVOCATION_ID. This variable is only set if the service has Type=notify. If this variable is set, systemd-notify has to be present. If not, I want to see the shell error.