gocron

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

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 11 Imported by: 1

README

gocron

Documentation

Overview

Package gocron allows to regularly run a job, and to be notified, when that run failed. Notifications can happen through e-mail, browser notifications, or a local file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cron

type Cron struct {
	Interval time.Duration
	LifeTime time.Duration // if set, we (and our webserver) exit after this time
	Job      func() error
	Mail     *MailAlert
	Notif    *Notification
	File     *StaticFile
}

func (*Cron) Run

func (c *Cron) Run()

type MailAlert

type MailAlert struct {
	Subject string

	To   []string
	From string
	SMTP string
	// contains filtered or unexported fields
}

func (*MailAlert) Msg

func (m *MailAlert) Msg() string

func (*MailAlert) Send

func (m *MailAlert) Send(alert error) error

type Notification

type Notification struct {
	Host    string
	Msg     string
	Timeout time.Duration // if set, we close the tab after this duration
	// contains filtered or unexported fields
}

func (*Notification) Send

func (n *Notification) Send(err error) error

func (*Notification) ServeHTTP

func (n *Notification) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StaticFile

type StaticFile struct {
	Path string
	Msg  string
}

func (*StaticFile) WriteAlert

func (s *StaticFile) WriteAlert(jobErr error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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