15 lines
512 B
C#
15 lines
512 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace InnovEnergy.App.SaliMax;
|
|
|
|
// 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. "
|
|
[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");
|
|
} |