Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - func AddJob(spec string, job *Job) bool
 - func AddSender(sender func(alertData *alert.AlertData) error)
 - func AddSystemJob(name string, fn RunnerGetter, example string, description string)
 - func Close()
 - func CmdParams(command string) []string
 - func DeleteScriptFile(id uint) error
 - func EmailSender(alertData *alert.AlertData) error
 - func GetEntries(size int) []cron.Entry
 - func GetEntryById(id uint) *cron.Entry
 - func HistoryJobsRunning() bool
 - func InitJobs(ctx context.Context) error
 - func Initial(sizes ...int)
 - func MainCron(mustStart bool) *cron.Cron
 - func OtherSender(alertData *alert.AlertData) error
 - func Parse(spec string) error
 - func Register(name string, fn RunnerGetter, example string, description string)
 - func RemoveJob(id uint)
 - func Running() bool
 - func SaveScriptFile(m *dbschema.NgingTask) error
 - func ScriptCommand(id uint, command string) string
 - func ScriptFile(id uint) string
 - func Send(alertData *alert.AlertData) (err error)
 - type Job
 - type Jobx
 - type OutputWriter
 - type Runner
 - type RunnerGetter
 
Constants ¶
      View Source
      
  
const ( //NotifyDisabled 不通知 NotifyDisabled = iota //NotifyIfEnd 执行结束时通知 NotifyIfEnd //NotifyIfFail 执行失败时通知 NotifyIfFail )
Variables ¶
      View Source
      
  
    var ( // SendMail 发送Email // @param toEmail 收信邮箱 // @param toUsername 收信人名称 // @param title 邮件标题 // @param content 邮件内容 // @param ccList 抄送地址 SendMail = send.Mail // SendMailWithID 发送Email(带ID参数) SendMailWithID = send.MailWithID // SendMailWithNoticer 发送Email(带Noticer参数) SendMailWithNoticer = send.MailWithNoticer // SendMailWithIDAndNoticer 发送Email(带ID和Noticer参数) SendMailWithIDAndNoticer = send.MailWithIDAndNoticer NewCmdRec = writer.New )
      View Source
      
  
    var ( // ErrFailure 报错:执行失败 ErrFailure = errors.New(`Error`) )
      View Source
      
  
var (
	PoolSize = 50 //连接池容量
)
    Functions ¶
func AddSystemJob ¶
func AddSystemJob(name string, fn RunnerGetter, example string, description string)
AddSystemJob 添加系统Job
func DeleteScriptFile ¶
func EmailSender ¶
func GetEntries ¶
func GetEntryById ¶
func HistoryJobsRunning ¶
func HistoryJobsRunning() bool
func OtherSender ¶
func SaveScriptFile ¶
func ScriptCommand ¶
func ScriptFile ¶
Types ¶
type Job ¶
type Job struct {
	// contains filtered or unexported fields
}
    Job 定义需要处理的job
func NewCommandJob ¶
func NewJobFromTask ¶
type Jobx ¶
type Jobx struct {
	Name         string
	Example      string //">funcName:param"
	Description  string
	RunnerGetter RunnerGetter
}
    type OutputWriter ¶
type OutputWriter = writer.OutputWriter
func NewOutputWriter ¶
func NewOutputWriter(sizes ...uint64) OutputWriter
type Runner ¶
type Runner func(timeout time.Duration) (out string, runingErr string, onRunErr error, isTimeout bool)
Runner 命令运行
type RunnerGetter ¶
 Click to show internal directories. 
   Click to hide internal directories.