Documentation ¶
Overview ¶
Package sdnotify provides a Go implementation of the sd_notify protocol. It can be used to inform systemd of service start-up completion, watchdog events, and other status changes.
https://www.freedesktop.org/software/systemd/man/sd_notify.html#Description
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SdNotify ¶
SdNotify sends a message to the init daemon. It is common to ignore the error. If `unsetEnvironment` is true, the environment variable `NOTIFY_SOCKET` will be unconditionally unset.
It returns one of the following: (false, nil) - notification not supported (i.e. NOTIFY_SOCKET is unset) (false, err) - notification supported, but failure happened (e.g. error connecting to NOTIFY_SOCKET or while sending data) (true, nil) - notification supported, data has been sent
func StartWatchdog ¶
func StartWatchdog(interval int, stopCh <-chan struct{})
Types ¶
type State ¶
type State string
const ( // Ready tells the service manager that service startup is finished // or the service finished loading its configuration. // https://www.freedesktop.org/software/systemd/man/sd_notify.html#READY=1 Ready State = "READY=1" // Stopping tells the service manager that the service is beginning // its shutdown. Stopping State = "STOPPING=1" // Reloading tells the service manager that this service is // reloading its configuration. Note that you must call SdNotifyReady when // it completed reloading. Reloading State = "RELOADING=1" // Watchdog tells the service manager to update the watchdog // timestamp for the service. Watchdog = "WATCHDOG=1" )