juju: github.com/wallyworld/juju/service/common Index | Files | Directories

package common

import "github.com/wallyworld/juju/service/common"


Package Files

conf.go service.go shell.go

func IsCmdNotFoundErr Uses

func IsCmdNotFoundErr(err error) bool

IsCmdNotFoundErr returns true if the provided error indicates that the command passed to exec.LookPath or exec.Command was not found.

func Unquote Uses

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.

type Conf Uses

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.
    // Valid values are integers or "infinity"
    Limit map[string]string

    // 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 Uses

func (c Conf) IsZero() bool

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

func (Conf) Validate Uses

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

Validate checks the conf's values for correctness.

type Service Uses

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 application.Service implementations.

func (Service) NoConf Uses

func (s Service) NoConf() bool

NoConf checks whether or not Conf has been set.

func (*Service) UpdateConfig Uses

func (s *Service) UpdateConfig(conf Conf)

UpdateConfig implements service.Service.

func (Service) Validate Uses

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

Validate checks the service's values for correctness.



Package common imports 7 packages (graph). Updated 2020-04-21. Refresh now. Tools for package owners.