Documentation ¶
Overview ¶
Many services that run on different platforms cannot rely on flags to be passed for configuration. Some platforms require explicit install commands. This package handles the common boilerplate code. The following command may be passed to the executable as the first argument:
install | remove | run | start | stop
These commands will do the following actions:
install - Install the running executable as a service on the system. remove - Remove the running executable as a service on the system. run - Run the service as a command line application, output log to prompt. start - Starts the service via system controls. stop - Stops the service via system controls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Used to register the service with the operating system.
Name, DisplayName, LongDescription string
// Called when the service starts or stops.
// Stop may be nil.
Start, Stop func(c *Config)
// Called after logging may be setup but before the service is started.
// Init is optional and may be nil.
// If Init returns an error, that error is logged to the logger
// and the service start is aborted.
// Init should not block.
Init func(c *Config) error
// contains filtered or unexported fields
}
Standard service configuration. Start MUST block. Stop MUST NOT block for more then a second or two.
type ConsoleLogger ¶
type ConsoleLogger struct{}
func (ConsoleLogger) Error ¶
func (ConsoleLogger) Error(format string, a ...interface{}) error
func (ConsoleLogger) Info ¶
func (ConsoleLogger) Info(format string, a ...interface{}) error
func (ConsoleLogger) Warning ¶
func (ConsoleLogger) Warning(format string, a ...interface{}) error
Click to show internal directories.
Click to hide internal directories.