autostart

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package autostart manage start at login unit files for darwin/linux

Package autostart manage start at login unit files for darwin/linux

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = fmt.Errorf("autostart is not supported on %s", runtime.GOOS)

Functions

func AutoStartedIdentifier

func AutoStartedIdentifier() string

AutoStartedIdentifier returns the identifier if the current process was started by the autostart manager.

func EnvTemplateVars added in v2.3.0

func EnvTemplateVars() (map[string]string, error)

EnvTemplateVars returns the "LimaHome" and "Path" template variables. Every renderer of a launchd plist or systemd unit must use it so they all carry the same environment.

func IsRegistered

func IsRegistered(ctx context.Context, inst *limatype.Instance) (bool, error)

IsRegistered checks if the instance is registered to start at login.

func RegisterToStartAtLogin

func RegisterToStartAtLogin(ctx context.Context, inst *limatype.Instance) error

RegisterToStartAtLogin creates a start-at-login entry for the instance.

func RequestStart

func RequestStart(ctx context.Context, inst *limatype.Instance) error

RequestStart requests to start the instance by identifier.

func RequestStop

func RequestStop(ctx context.Context, inst *limatype.Instance) (bool, error)

RequestStop requests to stop the instance by identifier.

func UnregisterFromStartAtLogin

func UnregisterFromStartAtLogin(ctx context.Context, inst *limatype.Instance) error

UnregisterFromStartAtLogin deletes the start-at-login entry for the instance.

Types

type AutoStartManager added in v2.2.1

type AutoStartManager interface {
	// Registration
	IsRegistered(ctx context.Context, inst *limatype.Instance) (bool, error)
	RegisterToStartAtLogin(ctx context.Context, inst *limatype.Instance) error
	UnregisterFromStartAtLogin(ctx context.Context, inst *limatype.Instance) error

	// Status
	AutoStartedIdentifier() string

	// Operation
	// RequestStart requests to start the instance by identifier.
	RequestStart(ctx context.Context, inst *limatype.Instance) error
	// RequestStop requests to stop the instance by identifier.
	RequestStop(ctx context.Context, inst *limatype.Instance) (bool, error)
}

AutoStartManager manages registration and lifecycle of auto-started instances.

func DaemonManager added in v2.2.0

func DaemonManager(_ string) AutoStartManager

DaemonManager is not supported on Linux; use systemd user services instead.

func Manager

func Manager() AutoStartManager

Manager returns the autostart manager for Linux, with keep-alive enabled by default.

func ManagerWith added in v2.3.0

func ManagerWith(keepAlive bool) AutoStartManager

ManagerWith returns the autostart manager for Linux. keepAlive controls the systemd unit's Restart= directive: on-failure when enabled, no when disabled.

type TemplateFileBasedManager

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

TemplateFileBasedManager is an autostart manager that uses a template file to create the autostart entry.

func (*TemplateFileBasedManager) AutoStartedIdentifier

func (t *TemplateFileBasedManager) AutoStartedIdentifier() string

func (*TemplateFileBasedManager) IsRegistered

func (t *TemplateFileBasedManager) IsRegistered(_ context.Context, inst *limatype.Instance) (bool, error)

func (*TemplateFileBasedManager) RegisterToStartAtLogin

func (t *TemplateFileBasedManager) RegisterToStartAtLogin(ctx context.Context, inst *limatype.Instance) error

func (*TemplateFileBasedManager) RequestStart

func (t *TemplateFileBasedManager) RequestStart(ctx context.Context, inst *limatype.Instance) error

func (*TemplateFileBasedManager) RequestStop

func (t *TemplateFileBasedManager) RequestStop(ctx context.Context, inst *limatype.Instance) (bool, error)

func (*TemplateFileBasedManager) UnregisterFromStartAtLogin

func (t *TemplateFileBasedManager) UnregisterFromStartAtLogin(ctx context.Context, inst *limatype.Instance) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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