Documentation
¶
Overview ¶
Package supervise runs a server process in the foreground and gives every platform the same controls: a console socket for sending commands to the server's stdin, a clean stop that types the server's own stop command before resorting to signals, and a log file.
Service managers (systemd, Windows services, launchd) and containers all run `anyserve run <name>`, which ends up here, so stopping behaves the same everywhere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Command string
Args []string
Dir string
Env []string
// StopCommand is written to stdin to stop the server cleanly.
StopCommand string
// StopFunc, if set, sends StopCommand another way (such as RCON)
// instead of writing it to stdin.
StopFunc func() error
StopTimeout time.Duration
// Socket is the console socket path. Empty disables it.
Socket string
// LogDir receives server.log. Empty disables the log file.
LogDir string
// Stdout receives the server's output as well (e.g. the journal).
Stdout io.Writer
// Log receives the supervisor's own messages.
Log func(format string, a ...any)
}
Options configures one supervised run.