daemon

package
v0.0.0-...-d3cd4ed Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 5 Imported by: 882 modules, 1,023 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package daemon 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

View Source
const (
	// SdNotifyReady tells the service manager that service startup is finished
	// or the service finished loading its configuration.
	SdNotifyReady = "READY=1"

	// SdNotifyStopping tells the service manager that the service is beginning
	// its shutdown.
	SdNotifyStopping = "STOPPING=1"

	// SdNotifyReloading tells the service manager that this service is
	// reloading its configuration. Note that you must call SdNotifyReady when
	// it completed reloading.
	SdNotifyReloading = "RELOADING=1"

	// SdNotifyWatchdog tells the service manager to update the watchdog
	// timestamp for the service.
	SdNotifyWatchdog = "WATCHDOG=1"
)

Variables

This section is empty.

Functions

func SdNotify

func SdNotify(unsetEnvironment bool, state string) (bool, error)

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 SdWatchdogEnabled

func SdWatchdogEnabled(unsetEnvironment bool) (time.Duration, error)

SdWatchdogEnabled returns watchdog information for a service. Processes should call daemon.SdNotify(false, daemon.SdNotifyWatchdog) every time / 2. If `unsetEnvironment` is true, the environment variables `WATCHDOG_USEC` and `WATCHDOG_PID` will be unconditionally unset.

It returns one of the following: (0, nil) - watchdog isn't enabled or we aren't the watched PID. (0, err) - an error happened (e.g. error converting time). (time, nil) - watchdog is enabled and we can send ping.

time is delay before inactive service will be killed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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