using System.Runtime.InteropServices; namespace InnovEnergy.Lib.Utils; // https://www.freedesktop.org/software/systemd/man/sd_notify.html public static class Watchdog { // "it is generally recommended to ignore the return value of this call. " // ReSharper disable once StringLiteralTypo [DllImport("libsystemd.so.0")] private static extern Int32 sd_notify(Int32 unsetEnvironment, String state); public static void NotifyReady() => _ = sd_notify(0, "READY=1"); public static void NotifyAlive() => _ = sd_notify(0, "WATCHDOG=1"); }