Documentation
¶
Index ¶
- Constants
- Variables
- func Child() bool
- func Exec(a *Again) error
- func ForkExec(a *Again) error
- func IsErrClosing(err error) bool
- func Kill() error
- func ListenFrom(a *Again, forkHook func()) error
- func ListerName(l net.Listener) string
- func Wait(a *Again) (syscall.Signal, error)
- type Again
- func (a Again) Close() error
- func (a Again) Delete(name string)
- func (a *Again) Env() (m map[string]string, err error)
- func (a Again) Get(name string) *Service
- func (a Again) GetListener(key string) net.Listener
- func (a *Again) Listen(name string, ls net.Listener) error
- func (a *Again) Range(fn func(*Service))
- type Hooks
- type Service
Constants ¶
View Source
const ( SIGINT = syscall.SIGINT SIGQUIT = syscall.SIGQUIT SIGTERM = syscall.SIGTERM SIGUSR2 = syscall.SIGUSR2 )
Don't make the caller import syscall.
Variables ¶
View Source
var OnForkHook func()
Functions ¶
func Child ¶
func Child() bool
Child returns true if this process is managed by again and its a child process.
func IsErrClosing ¶
IsErrClosing tests whether an error is equivalent to net.errClosing as returned by Accept during a graceful exit.
func Kill ¶
func Kill() error
Kill process specified in the environment with the signal specified in the environment; default to SIGQUIT.
func ListenFrom ¶
func ListerName ¶
Types ¶
type Again ¶
type Again struct { Hooks Hooks // contains filtered or unexported fields }
Again manages services that need graceful restarts
func Listen ¶
Listen checks env and constructs a Again instance if this is a child process that was froked by again parent.
forkHook if provided will be called before forking.
type Hooks ¶
type Hooks struct { // OnSIGHUP is the function called when the server receives a SIGHUP // signal. The normal use case for SIGHUP is to reload the // configuration. OnSIGHUP func(*Again) error // OnSIGUSR1 is the function called when the server receives a // SIGUSR1 signal. The normal use case for SIGUSR1 is to repon the // log files. OnSIGUSR1 func(*Again) error // OnSIGQUIT use this for graceful shutdown OnSIGQUIT func(*Again) error OnSIGTERM func(*Again) error }
Hooks callbacks invoked when specific signal is received.
Click to show internal directories.
Click to hide internal directories.