starter

package
v0.0.0-...-694d8f9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

View Source
const (
	ServiceStop    ServiceState = "stop"
	ServiceStart                = "start"
	ServiceRestart              = "restart"
	ServiceStatus               = "status"
)

Variables

This section is empty.

Functions

func GetCommandPrefix

func GetCommandPrefix() string

GetCommandPrefix return used command prefix

func Install

func Install(name string) (err error)

Install - install program

func IsInstalled

func IsInstalled(name string) error

IsInstalled - check program is installed

func Register

func Register(name string, starter Starter)

Register makes a starter available by the provided name. If Register is called twice with the same name or if starter is nil, it panics.

func ServiceAction

func ServiceAction(state ServiceState, serviceName string) (err error)

ServiceAction run action for service systemctl <action> <service-name> Example : systemctl restart ssh

func SetCommandPrefix

func SetCommandPrefix(prefix string)

SetCommandPrefix - add prefix before each command. Typically used for ssh, docker, ... Example for ssh prefix is `ssh some@localhost`

func WriteFile

func WriteFile(location string, body []byte) (err error)

WriteFile is write file

Types

type ServiceState

type ServiceState string

ServiceState is state of systemctl service

type SimpleInstall

type SimpleInstall struct {
	ProgramName string // Name of program
}

SimpleInstall - base type for program just install

func (SimpleInstall) Run

func (s SimpleInstall) Run() (err error)

Run - install program without any other settings

type Starter

type Starter interface {
	Run() error
}

Starter - base interface

type StarterItem

type StarterItem struct {
	Name string
	S    Starter
}

func List

func List() []StarterItem

List returns a sorted list of the names of the registered starters.

Jump to

Keyboard shortcuts

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