Documentation ¶
Overview ¶
* file: paths.go
This file provides functions for getting paths to various files and directories regarding the program and its contexts.
Index ¶
- Constants
- Variables
- func GetCommandLine(binPath string, args []string) string
- type InvalidContextError
- type Program
- func (p *Program) DataDirectory(create bool) (string, error)
- func (p *Program) InstallBinary(sourceBin string) error
- func (p *Program) InstallDirectory(create bool) (string, error)
- func (p *Program) Installed() bool
- func (p *Program) InstalledBinary() (string, error)
- func (p *Program) RegisterStartup() error
- func (p *Program) RemoveInstallation() error
- func (p *Program) RemoveStartup() error
- func (p *Program) RunWatchdog(errs chan error, msgs chan string, quit chan interface{})
- func (p *Program) SafeName() string
- func (p *Program) Uninstall() error
- type ProgramContext
Constants ¶
const PID_FILE = "watchdog.pid"
Variables ¶
var ErrPathNotFound = errors.New("path not found")
Functions ¶
func GetCommandLine ¶ added in v0.2.1
Wrap the binary path in quotes and append the space separated args at the end, return the final string
Types ¶
type InvalidContextError ¶ added in v0.2.1
type InvalidContextError string
const ErrInvalidContext InvalidContextError = "Unknown application context"
func (InvalidContextError) Error ¶ added in v0.2.1
func (e InvalidContextError) Error() string
type Program ¶
type Program struct { // Name of the service Name string // Filename of service binary ExeFile string // Arguments to append when service is run Args []string // Path to installer for user context when AllUsers context is specified UserInstaller string // Installation context of the service InstallContext ProgramContext // Startup context of the service StartupContext ProgramContext // Watchdog retry count before failing, -1 for unlimited WatchRetries int // Watchdog interval between retries WatchRetryWait time.Duration // Watchdog factor to increase wait interval each failed attempt WatchRetryIncrease int }
Program defines a program installation that can be used to install, uninstall or start a watchdog based on the defined properties.
func (*Program) DataDirectory ¶
Get the path to the installation data directory
func (*Program) InstallBinary ¶ added in v0.2.0
Install sourceBin binary file to p.ExeFile in the install directory
func (*Program) InstallDirectory ¶
Get the path to the installation directory
func (*Program) InstalledBinary ¶ added in v0.2.0
Get the path to the ExeFile inside the installation directory
func (*Program) RegisterStartup ¶
Register the installed service startup on linux
func (*Program) RemoveInstallation ¶ added in v0.2.0
Remove installation directories specified by InstallContext and StartupContext
func (*Program) RemoveStartup ¶
Deregister the installed service from startup on linux
func (*Program) RunWatchdog ¶
Start the watchdog runner
type ProgramContext ¶
type ProgramContext int
Specifies the type of program installation, so that Program can customize how it installs and configures startup on each system.
const ( // A global context to install and run user session software for all users AllUsers ProgramContext = iota // A local context to install and run user session software for the current user CurrentUser // A global context to install and run a system level service not running in a user context SystemService )