Documentation
¶
Overview ¶
Package pico provides the service manager used by picoinit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook struct { // The full path to the binary for the pre-hook. Cmd string // The list of command line arguments that will need to be passed // to the binary for starting this hook. Args []string }
Hook represents the command/script that will be invoked by Init prior to launching the services. Init will wait for the termination of this hook with a success exit status prior to launching the services.
type Init ¶
type Init interface { // Wait initiates the blocking wait of the init process. The // call doesn't return until all the services have terminated. // The return value indicates the final exit status to be used. Wait() int }
Init manages init responsibility in a system (by reaping processes which get parented to pid 1), and allows launching/managing services (including forwarding signals to them from the process where Init is running).
func NewInit ¶
func NewInit(config *InitConfig) (Init, error)
NewInit instantiates a Pico Init/Service Manager combo, performs the necessary initialization for the init responsibilities, launches the pre-hook (if one was specified) and launches the specified list of services. The call will block till the pre-hook exits prior to launching the services. The call does not block on all services to exit. Instead use Init.Wait() to block on the termination of all the services.
type InitConfig ¶
type InitConfig struct { // The logger used by Init. Log tuxlogi.Logger // The pre-hook to be executed prior to launching the services. The // services will not be launched until the pre-hook exits successfully. // If the pre-hook exits with a non-zero exit status, Init will also fail. PreHook *Hook // The list of services to be launched and managed by Init. Init will start // the shut down procedure as soon as the first service terminates. As part // of the shut down procedure, Init will attempt to shut down any running // services gracefully with a SIGTERM three times, followed by a // non-graceful SIGKILL to terminate them prior to exiting. Services []*Service }
InitConfig is the configuration used by Init.