Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultEnvVariable = "DAEMON" PatternServiceName = "^[A-Za-z0-9_]+$" PatternEnvVariable = "^[A-Za-z0-9_]+$" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Daemonizer ¶
type Daemonizer struct {
// contains filtered or unexported fields
}
Daemonizer is a structure to control the service. Use the New function to create it.
func (*Daemonizer) IsService ¶
func (d *Daemonizer) IsService() (bool, error)
IsService should be executed at first in your main method. When the program is executed as the service, it executes your service function and then returns true. when the program is executed normally, it returns false, and you should use the Daemonizer to start or stop the service.
func (*Daemonizer) Start ¶
func (d *Daemonizer) Start() error
Start starts your program as background service.
func (*Daemonizer) Stop ¶
func (d *Daemonizer) Stop() error
Stop tries to stop your running service.
Click to show internal directories.
Click to hide internal directories.