sysinit

package
v0.0.0-...-ff5f600 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2016 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package sysinit provides config generation for a variety of platforms and "init" systems such as upstart, systemd etc. It is intended purely for bootstrapping into the Vanadium system proper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSystem

func InitSystem() string

InitSystem attempts to determine what kind of init system is in use on the platform that it is run on. It recognises upstart and systemd by testing for the presence of the initctl and systemctl commands. upstart is tested for first and hence is preferred in the unlikely case that both are installed. Docker containers do not support upstart and systemd and for them we have our own init system that uses the daemon command to start/stop/respawn jobs.

Types

type DockerService

type DockerService ServiceDescription

DockerService is the implementation of InstallSystemInit interfacing with Docker.

func (*DockerService) Install

func (s *DockerService) Install() error

Install implements the InstallSystemInit method.

func (*DockerService) Print

func (s *DockerService) Print() error

Print implements the InstallSystemInit method.

func (*DockerService) Start

func (s *DockerService) Start() error

Start implements the InstallSystemInit method.

func (*DockerService) Stop

func (s *DockerService) Stop() error

Stop implements the InstallSystemInit method.

func (*DockerService) Uninstall

func (s *DockerService) Uninstall() error

Uninstall implements the InstallSystemInit method.

type InstallSystemInit

type InstallSystemInit interface {
	Print() error
	Install() error
	Uninstall() error
	Start() error
	Stop() error
}

InstallSystemInit defines the interface that all configs must implement.

func New

New returns the appropriate implementation of InstallSystemInit for the underlying system.

type ServiceDescription

type ServiceDescription struct {
	Service     string            // The name of the Service
	Description string            // A description of the Service
	Environment map[string]string // Environment variables needed by the service
	Binary      string            // The binary to be run
	Command     []string          // The script/binary and command line options to use to start/stop the binary
	User        string            // The username this service is to run as
}

ServiceDescription is a generic service description that represents the common configuration details for specific systems.

func (*ServiceDescription) LoadFrom

func (sd *ServiceDescription) LoadFrom(fName string) error

LoadFrom de-serializes the service description object from a file created by SaveTo.

func (*ServiceDescription) SaveTo

func (sd *ServiceDescription) SaveTo(fName string) error

SaveTo serializes the service description object to a file.

type SystemdService

type SystemdService ServiceDescription

SystemdService is the implementation of InstallSystemInit interfacing with the Systemd system.

func (*SystemdService) Install

func (s *SystemdService) Install() error

Install implements the InstallSystemInit method.

func (*SystemdService) Print

func (s *SystemdService) Print() error

Print implements the InstallSystemInit method.

func (*SystemdService) Start

func (s *SystemdService) Start() error

Start implements the InstallSystemInit method.

func (*SystemdService) Stop

func (s *SystemdService) Stop() error

Stop implements the InstallSystemInit method.

func (*SystemdService) Uninstall

func (s *SystemdService) Uninstall() error

Uninstall implements the InstallSystemInit method.

type UpstartService

type UpstartService ServiceDescription

UpstartService is the implementation of InstallSystemInit interfacing with the Upstart system.

func (*UpstartService) Install

func (u *UpstartService) Install() error

Implements the InstallSystemInit method.

func (*UpstartService) Print

func (u *UpstartService) Print() error

Print implements the InstallSystemInit method.

func (*UpstartService) Start

func (u *UpstartService) Start() error

Start implements the InstallSystemInit method.

func (*UpstartService) Stop

func (u *UpstartService) Stop() error

Stop implements the InstallSystemInit method.

func (*UpstartService) Uninstall

func (u *UpstartService) Uninstall() error

Implements the InstallSystemInit method.

Jump to

Keyboard shortcuts

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