Documentation
¶
Overview ¶
Package systemd provides zero-dependency Linux systemd sd_notify and watchdog integration.
Index ¶
Constants ¶
const ( Ready = "READY=1" Stopping = "STOPPING=1" Watchdog = "WATCHDOG=1" Reloading = "RELOADING=1" )
State constants for sd_notify.
Variables ¶
var LookPath = exec.LookPath
LookPath finds the package manager; tests replace it.
Functions ¶
func Notify ¶
Notify sends a state notification to the systemd service manager if running under systemd. If NOTIFY_SOCKET is not set (e.g. on Windows, dev mode, or non-systemd init), it returns nil.
func StartWatchdog ¶
StartWatchdog starts a background goroutine that periodically pings systemd with WATCHDOG=1 at half the configured WATCHDOG_USEC interval until ctx is cancelled. Returns false if watchdog is not enabled by systemd.
func WatchdogInterval ¶
WatchdogInterval returns the duration specified in WATCHDOG_USEC, or 0 if disabled.