goup

package
v0.0.0-...-dc1fca4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

README

goup: Creating Upstart Scripts

Upstart is a mechanism to handle services on Ubuntu (like SysInitV used to do). Keep in mind that this stuff requires quite some knowledge and understanding on how processes can daemonize.

Currently there is only support for a small subset of possible options. This will be expanded as required.

Usage is as simple as creating an value of the Upstart type and call it's CreateScript() string method to get the string version of the resulting upstart script. Write that to the according location.

Documentation

Overview

A package to create upstart scripts. These scripts are essential to make rebooting boxes safe, but contain an inherent complexity that requires some understanding of what is going on.

NOTE: This is work in progress. There are quite some options not supported yet!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Upstart

type Upstart struct {
	Name        string // Name of the upstart script. Used for the file located in /etc/init.
	Description string // Description of the service provided.

	StartOnEvents []string // Events the service should be started on.
	StopOnEvents  []string // Events the service should be stopped at.

	WorkingDirectory string            // Directory to be used as CWD for the exec statement or script.
	Environment      map[string]string // Environment variables set and available in all script sections.
	Exports          []string          // List of env variables to be exported to all events resulting from this job.

	Exec            string // Command to run to start the service.
	Script          string // Script to be executed to start the service.
	PostStartScript string // Script to be executed post start.
	PostStopScript  string // Script to be executed post stop.
	PreStartScript  string // Script to be executed pre start.
	PreStopScript   string // Script to be executed pre stop.

	Expect               string // TODO Expected behavior of the started command (with regard to daemonization).
	Instance             string // TODO Instance handling.
	Respawn              bool   // TODO ???
	RespawnLimitCount    int    // TODO Number of times the job might be respawned in the given interval.
	RespawnLimitInterval int    // TODO Time frame the job might be respawned the given times.
	OomScore             int    // TODO Configuration of the kernel's "Out of memory" killer facility.

	Limit []string    // TODO Resource limits of the job started
	Nice  int         // TODO Set the job's scheduling priority.
	Gid   string      // TODO All processes are run as the given group.
	Uid   string      // TODO All processes are run as the given user.
	Umask os.FileMode // TODO File mode creation mask used for the job.

	KillSignal      string // TODO Signal used to terminate the service.
	KillTimeout     int    // TODO Number of seconds to wait for the kill signal to succeed.
	ReloadSignal    string // TODO Signal to be used for initiating a service reload.
	NormalExitCodes []int  // TODO List of exit codes considered 'normal'.

	Manual bool // TODO Don't start automatically, ignoring the start/stop configuration.
	Task   bool // TODO A short lived job.
}

func (*Upstart) CreateScript

func (u *Upstart) CreateScript() string

Create a string containing the content of the upstart script (should be save to "/etc/init/{{ u.Name }}").

Jump to

Keyboard shortcuts

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