ewn

package
v0.0.0-...-a798fdd Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(configPath string) (*viper.Viper, error)

GetConfig return config struct

func InitConfig

func InitConfig(configPath string) error

InitConfig create default config file in given path

func Notify

func Notify(msg *Message, cfg *viper.Viper)

Notify send notifications over all channels

Types

type Args

type Args struct {
	Command          string   `arg:"-c"`
	Recipients       []string `arg:"-r"`
	Comment          string   `help:"Comment for email Message"`
	ValidExitCode    []int    `arg:"--valid-exitcodes" help:"Valid exitcodes for executed command"`
	Daemon           bool     `arg:"-d" help:"Daemonize process after start. DONT implemented"`
	DontDuplicate    bool     `arg:"--dont-duplicate" help:"Not run process when process with same key already run"`
	DontDuplicateKey string   `arg:"--dont-duplicate-key" help:"Default: --command value"`
	Retry            int      `help:"Retry run N times on fail."`
	Timeout          int      `arg:"-t" help:"Kill process after N seconds. Default: 0"`
	RetrySleep       int      `arg:"--retry-sleep" help:"Sleep between retries (seconds)"`
	Tty              bool     `help:"Allocate pseudo-terminal for executed command"`
	Config           string   `help:"Path to config file."`
	InitConfig       bool     `help:"Write default config to --config path and exit"`
}

Args cli args structure

func GetCliArgs

func GetCliArgs() (cli Args)

GetCliArgs return cli args structure

type ErrLockAlreadyAquired

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

ErrLockAlreadyAquired : error, that returned then lock already acquired by another process

func (*ErrLockAlreadyAquired) Error

func (e *ErrLockAlreadyAquired) Error() string

type ErrLockAquireFailed

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

ErrLockAquireFailed : error, that returned then lock acquire failed with error

func (*ErrLockAquireFailed) Error

func (e *ErrLockAquireFailed) Error() string

type ErrLockNotOwned

type ErrLockNotOwned struct{}

ErrLockNotOwned : error, that returned then you trying release not owned lock

func (*ErrLockNotOwned) Error

func (e *ErrLockNotOwned) Error() string

type ErrLockReleaseFailed

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

ErrLockAquireFailed : error, that returned then lock acquire failed with error

func (*ErrLockReleaseFailed) Error

func (e *ErrLockReleaseFailed) Error() string

type Lock

type Lock struct {
	Key string
	// contains filtered or unexported fields
}

Lock manage lock file

func (*Lock) Acquire

func (l *Lock) Acquire() error

Acquire trying to acquire lock. Return error on error or nil on success

func (*Lock) Release

func (l *Lock) Release() error

Release lock. Return error on error or nil on success

type Message

type Message struct {
	Args         Args
	Host         string
	Retries      []Retry
	GeneralError error
}

Message is output message structure

type Retry

type Retry struct {
	ExitCode  int
	Output    string
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration
	Retry     int
}

Retry contains command execution result

func Popen

func Popen(command string, timeout time.Duration, tty bool) (result Retry, err error)

Popen execute given command and return retry structure

Jump to

Keyboard shortcuts

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