serviceCmd

package
v0.0.0-...-05317bf Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServiceExist = errors.New("Service already exist")

Functions

func AddCommandList

func AddCommandList()

func Install

func Install(s *Service) (err error)

func ListenAndServe_ServiceRpc

func ListenAndServe_ServiceRpc(addr string, obj *ServiceRpc, psk *[32]byte) (closer func() error)

server

func NewServer_ServiceRpc

func NewServer_ServiceRpc(obj *ServiceRpc, psk *[32]byte) http.Handler

func Restart

func Restart(name string) (err error)

func RestartV1

func RestartV1(name string) (err error)

func ServiceStartFail

func ServiceStartFail()

暂时没什么用

func ServiceStartSuccess

func ServiceStartSuccess()

func SetClient_ServiceRpcConfig

func SetClient_ServiceRpcConfig(RemoteAddr string, Psk *[32]byte)

全局函数,请先设置客户端的地址,再获取全局客户端,此处不能并发调用

func Start

func Start(name string) (err error)

func Stop

func Stop(name string) (err error)

TODO 已经关闭不是错误

func Uninstall

func Uninstall(name string) (err error)

Types

type Client_ServiceRpc

type Client_ServiceRpc struct {
	RemoteUrl string // http://kmg.org:1234/
	Psk       *[32]byte
}

func GetClient_ServiceRpc

func GetClient_ServiceRpc() *Client_ServiceRpc

func NewClient_ServiceRpc

func NewClient_ServiceRpc(RemoteUrl string, Psk *[32]byte) *Client_ServiceRpc

func (*Client_ServiceRpc) Send

func (c *Client_ServiceRpc) Send(Status StartStatus) (Err error)

type FileMutex

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

func (*FileMutex) Lock

func (fm *FileMutex) Lock(name string)

func (*FileMutex) UnLock

func (fm *FileMutex) UnLock()

type Service

type Service struct {
	Name             string //Required
	WorkingDirectory string
	CommandLineSlice []string //Required 运行命令需要的slice数组.不要包含空格
}

这个是服务的定义数据结构,会序列化到具体实现的配置文件里面去

func (*Service) GetCommandLineBashString

func (s *Service) GetCommandLineBashString() string

type ServiceRpc

type ServiceRpc struct{}

func (*ServiceRpc) Send

func (sr *ServiceRpc) Send(status StartStatus)

type StartStatus

type StartStatus string
const (
	StartStatusSuccess StartStatus = "StartStatusSuccess"
	StartStatusFail                = "StartStatusFail"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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