upstart

package
v0.0.0-...-732aecd Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2014 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitDir = "/etc/init"

InitDir holds the default init directory name.

View Source
var InstallStartRetryAttempts = utils.AttemptStrategy{
	Total: 1 * time.Second,
	Delay: 250 * time.Millisecond,
}

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Service
	// Desc is the upstart service's description.
	Desc string
	// Env holds the environment variables that will be set when the command runs.
	Env map[string]string
	// Limit holds the ulimit values that will be set when the command runs.
	Limit map[string]string
	// Cmd is the command (with arguments) that will be run.
	// The command will be restarted if it exits with a non-zero exit code.
	Cmd string
	// Out, if set, will redirect output to that path.
	Out string
}

Conf is responsible for defining and installing upstart services. Its fields represent elements of an upstart service configuration file.

func MachineAgentUpstartService

func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId string, env map[string]string) *Conf

MachineAgentUpstartService returns the upstart config for a machine agent based on the tag and machineId passed in.

func (*Conf) Install

func (c *Conf) Install() error

Install installs and starts the service.

func (*Conf) InstallCommands

func (c *Conf) InstallCommands() ([]string, error)

InstallCommands returns shell commands to install and start the service.

type Service

type Service struct {
	Name    string
	InitDir string // defaults to "/etc/init"
}

Service provides visibility into and control over an upstart service.

func NewService

func NewService(name string) *Service

func (*Service) Installed

func (s *Service) Installed() bool

Installed returns whether the service configuration exists in the init directory.

func (*Service) Remove

func (s *Service) Remove() error

Remove deletes the service configuration from the init directory.

func (*Service) Running

func (s *Service) Running() bool

Running returns true if the Service appears to be running.

func (*Service) Start

func (s *Service) Start() error

Start starts the service.

func (*Service) Stop

func (s *Service) Stop() error

Stop stops the service.

func (*Service) StopAndRemove

func (s *Service) StopAndRemove() error

StopAndRemove stops the service and then deletes the service configuration from the init directory.

Jump to

Keyboard shortcuts

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