daemon

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PidFile = Directory() + "/daemon.pid"

PidFile is the file where the pid of the daemon is stored

View Source
var StatusFile = Directory() + "/daemon.status"

StatusFile is the file where the status of the daemon is stored

Functions

func Directory

func Directory() string

Directory is the path of the directory containing the daemon control files

func NewPipeline

func NewPipeline() (*validation.Pipeline, error)

func Pid

func Pid() (int, error)

Pid returns the pid of the daemon. If the pid file cannot be read, it returns 0 with an *errors.CannotReadPidError. If the daemon is not running the returned pid is -1.

func ReloadDaemon

func ReloadDaemon() error

ReloadDaemon sends a SIGHUP to the daemon to force it to reload its configuration. If an error occurs the error will be of type *errors.CannotReloadDaemonError.

func Start

func Start(runOnStart bool) error

Start starts the daemon. If the daemon is already running it returns an *errors.CannotLockFileError because the already running daemon has the lock on the file.

func Stop

func Stop() error

Stop stops the daemon. If there is no daemon running it return an *errors.DaemonNotRunningError.

Types

type State

type State string

State represents the possible states of the daemon

const (
	UP   State = "up"
	DOWN State = "down"
)

func Status

func Status() (State, error)

Status returns the status of the daemon. If the status file cannot be read, it returns DOWN with an *errors.CannotReadStatusError.

Jump to

Keyboard shortcuts

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