supervisorgo

package module
v0.0.0-...-983d800 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2018 License: BSD-2-Clause Imports: 8 Imported by: 0

README

BEWARE

This tool has not been maintained for a while. Please use https://immortal.run instead.

supervisorgo

supervisord like golang implement

feature

  • multiple process management.
  • cross platform (windows/linux/os-x) supported.
  • remote controll utility bundled.

install

go get -u github.com/supervisorgo/cmd/...

configuration json file

default-path = "execute-parent-dir/supervisorgo.json"

sample

{
	"ControlUri": "unix:./supervisorgo.sock",
	"Procs": [
		{
			"Name": "builder",
			"DisplayName": "Go Builder",
			"Description": "Run the Go Builder",

			"Dir": "/tmp",
			"Exec": "bash",
			"Args": ["-c","while true; do echo hello; sleep 5; exit 1; done"],
			"Env": [
			],

			"Stderr": "sample-err.log",
			"Stdout": "sample-out.log",
			"Interval": 1000,
			"Retry": 3
		}
	]
}

usage

foreground mode(for debug run)
supervisorgo -c config.json
supervisorgo daemon control
supervisorgo start
supervisorgo stop
supervisorgo restart
sudo supervisorgo install   # daemon install to system
sudo supervisorgo uninstall # daemon uninstall from system
usage for supervisorgoctl

supervisorctl [-c unix:./supervisorgo.sock] subcommand [args...]

supervisorctl status
(list procs)
supervisorctl status target-name
supervisorctl start target-name
supervisorctl stop target-name

TODO

  • add exec-user setting
  • use custom stop signal
  • sock default-path to /var/run/supervisorgo.sock
  • windows/linux/os-x install test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l service.Logger)

SetLogger ...

Types

type Config

type Config struct {
	Name, Description string
	Dir               string
	Exec              string
	Args              []string
	Env               []string
	Stderr, Stdout    string
	Retry             int
	StopSignal        string
	Interval          int
}

Config ...

type ConfigSet

type ConfigSet struct {
	ControlUri string
	Procs      []*Config
}

ConfigSet ...

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func (*Controller) Start

func (c *Controller) Start(target string, reply *Status) error

func (*Controller) Status

func (c *Controller) Status(target string, reply *[]Info) error

func (*Controller) Stop

func (c *Controller) Stop(target string, reply *Status) error

type Info

type Info struct {
	Name   string
	Since  time.Duration
	Status Status
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(config *ConfigSet) *Manager

NewManager ...

func (*Manager) HTTPServe

func (m *Manager) HTTPServe(path string)

func (*Manager) Run

func (m *Manager) Run(name string)

func (*Manager) Start

func (m *Manager) Start(s service.Service) error

func (*Manager) Stop

func (m *Manager) Stop(s service.Service) error

type Process

type Process struct {
	// contains filtered or unexported fields
}

Process ...

func New

func New(config *Config) *Process

New ...

func (*Process) Cmd

func (p *Process) Cmd() *exec.Cmd

Cmd ...

func (*Process) First

func (p *Process) First() time.Time

First ...

func (*Process) Name

func (p *Process) Name() string

Name ...

func (*Process) Retry

func (p *Process) Retry() int

Retry ...

func (*Process) Since

func (p *Process) Since() time.Duration

Since ...

func (*Process) Start

func (p *Process) Start() <-chan error

Start ...

func (*Process) Status

func (p *Process) Status() Status

Status ...

func (*Process) Stop

func (p *Process) Stop() error

Stop ...

type Status

type Status int

Status ...

const (
	STOPPED Status = iota
	STANDBY
	RUNNING
	STOPPING
	RETRYWAIT
)

func (Status) String

func (s Status) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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