common

package
v0.0.0-...-be26699 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2015 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unquote

func Unquote(str string) string

Unquote returns the string embedded between matching quotation marks. If there aren't any matching quotation marks then the string is returned as-is.

Types

type Conf

type Conf struct {
	// Desc is the init service's description.
	Desc string

	// Transient indicates whether or not the service is a one-off.
	Transient bool

	// AfterStopped is the name, if any, of another service. This
	// service will not start until after the other stops.
	AfterStopped string

	// Env holds the environment variables that will be set when the
	// command runs.
	// Currently not used on Windows.
	Env map[string]string

	// Limit holds the ulimit values that will be set when the command
	// runs. Each value will be used as both the soft and hard limit.
	// Currently not used on Windows.
	Limit map[string]int

	// Timeout is how many seconds may pass before an exec call (e.g.
	// ExecStart) times out. Values less than or equal to 0 (the
	// default) are treated as though there is no timeout.
	Timeout int

	// ExecStart is the command (with arguments) that will be run. The
	// path to the executable must be absolute.
	// The command will be restarted if it exits with a non-zero exit code.
	ExecStart string

	// ExecStopPost is the command that will be run after the service stops.
	// The path to the executable must be absolute.
	ExecStopPost string

	// Logfile, if set, indicates where the service's output should be
	// written.
	Logfile string

	// ExtraScript allows to insert script before command execution.
	ExtraScript string

	// ServiceBinary is the actual binary without any arguments.
	ServiceBinary string

	// ServiceArgs is a string array of unquoted arguments
	ServiceArgs []string
}

Conf is responsible for defining services. Its fields represent elements of a service configuration.

func (Conf) IsZero

func (c Conf) IsZero() bool

IsZero determines whether or not the conf is a zero value.

func (Conf) Validate

func (c Conf) Validate(renderer shell.Renderer) error

Validate checks the conf's values for correctness.

type Service

type Service struct {
	// Name is the name of the service.
	Name string

	// Conf holds the info used to build an init system conf.
	Conf Conf
}

Service is the base type for service.Service implementations.

func (Service) NoConf

func (s Service) NoConf() bool

NoConf checks whether or not Conf has been set.

func (*Service) UpdateConfig

func (s *Service) UpdateConfig(conf Conf)

UpdateConfig implements service.Service.

func (Service) Validate

func (s Service) Validate(renderer shell.Renderer) error

Validate checks the service's values for correctness.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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