inithooks

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package inithooks provides support for running user-defined scripts on Gopherstack startup. Scripts are executed sequentially in the order they are listed, using the system shell. Any script that exits with a non-zero status is logged as an error but does not abort startup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes a list of init scripts on startup.

func New

func New(scripts []string, timeout time.Duration, log *slog.Logger) *Runner

New creates a new Runner. scripts is the ordered list of shell script paths to execute. timeout is the per-script execution timeout (zero defaults to 30 s). log may be nil (in which case no logging is performed).

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run executes each script sequentially. It blocks until all scripts have completed (or timed out). Errors from individual scripts are logged but do not stop subsequent scripts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL