sdnotify

package module
v0.0.0-...-1c1fdd3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 8 Imported by: 28

README

sdnotify

sd_notify utility for golang.

Installation

go get github.com/okzk/sdnotify

Example

see sample/main.go

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSdNotifyNoSocket = errors.New("No socket")

ErrSdNotifyNoSocket is the error returned when the NOTIFY_SOCKET does not exist.

View Source
var ErrWatchdogUsecNotSet = errors.New("WATCHDOG_USEC env variable is not set")

ErrWatchdogUsecNotSet is returned when the WATCHDOG_USEC env variable is not set.

Functions

func DoWatchdog

func DoWatchdog(
	ctx context.Context,
	isOk func() bool,
) error

DoWatchdog runs check twice every WatchdogInterval until the context closes. If check returns nil then the systemd watchdog is called.

func Errno

func Errno(errno int) error

Errno sends ERRNO=? to the systemd notify socket.

func Ready

func Ready() error

Ready sends READY=1 to the systemd notify socket.

func Reloading

func Reloading() error

Reloading sends RELOADING=1\nMONOTONIC_USEC=<monotonic_time> to the systemd notify socket.

func SdNotify

func SdNotify(state string) error

SdNotify sends a specified string to the systemd notification socket.

func Status

func Status(status string) error

Status sends STATUS=? to the systemd notify socket.

func Stopping

func Stopping() error

Stopping sends STOPPING=1 to the systemd notify socket.

func Watchdog

func Watchdog() error

Watchdog sends WATCHDOG=1 to the systemd notify socket.

func WatchdogInterval

func WatchdogInterval() (time.Duration, error)

WatchdogInterval finds the watchdog interval set by systemd.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL