keepalive

package module
v0.0.0-...-be9502f Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

keepalive

Keep a service or application alive

Documentation

Index

Constants

View Source
const (
	ServiceCheck   ServiceCommandTypeEnum = "Check"
	ServiceStart                          = "Start"
	ServiceStop                           = "Stop"
	ServiceRestart                        = "Restart"
)
View Source
const (
	OpEq          OpEnum = "eq"
	OpNeq                = "ne"
	OpContains           = "contains"
	OpNotContains        = "notcontains"
)
View Source
const (
	ServiceNotifStop    ServiceNotifEnum = "Service Stop"
	ServiceNotifRestart                  = "Service Restart"
	ServiceNotifFail                     = "Service Fail"
)

Variables

This section is empty.

Functions

func CmdToStrings

func CmdToStrings(txt string) []string

Types

type Command

type Command struct {
	CommandType CommandTypeEnum
	//Function    ServiceCommandTypeEnum
	Txt string

	Op            OpEnum
	Expected      string
	CaseSensitive bool
}

func (*Command) Exec

func (c *Command) Exec() *toolkit.Result

type CommandTypeEnum

type CommandTypeEnum string
const (
	CommandLine CommandTypeEnum = "Cmd"
	CommandUrl                  = "Url"
)

type Context

type Context struct {
	Port       int
	Verbose    bool
	Services   map[string]*Service
	SmtpClient *SmtpClient
	LogToFile  bool
	LogPath    string
	// contains filtered or unexported fields
}

func (*Context) Run

func (c *Context) Run() error

func (*Context) StartWebConsole

func (c *Context) StartWebConsole()

func (*Context) Stop

func (c *Context) Stop()

func (*Context) Wait

func (c *Context) Wait()

type EmailMsg

type EmailMsg struct {
	From          string
	To, Cc, Bcc   []string
	Subject, Body string
	Attachments   []string
	HtmlBody      bool
}

type OpEnum

type OpEnum string

type Service

type Service struct {
	Commands        map[string]Command
	Interval        time.Duration
	NotifyInterval  time.Duration
	CheckAgainAfter time.Duration
	NotifyTo        []string
	StopNotifyAfter int
	StopStartAfter  int
	Active          bool
	// contains filtered or unexported fields
}

func (*Service) Exec

func (*Service) SendEmail

func (s *Service) SendEmail(subject, message string)

func (*Service) StartMonitor

func (s *Service) StartMonitor()

func (*Service) StopMonitor

func (s *Service) StopMonitor()

type ServiceCommandTypeEnum

type ServiceCommandTypeEnum string

type ServiceNotifEnum

type ServiceNotifEnum string

type SmtpClient

type SmtpClient struct {
	Host, UserId, Password string
	Port                   int
	SSL                    bool
	TLS                    bool
}

func (*SmtpClient) Send

func (s *SmtpClient) Send(msgs ...*EmailMsg) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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