manager

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package manager can be used cross-platform to add apps as either userspace or system services for fairly simple applications. This is not intended for complex or highly platform-specific service installers.

I'm prototyping this out to be useful for more than just watchdog hence there are a few unnecessary things for the sake of the trying it out

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(c *service.Service) (string, error)

Install will do a best-effort attempt to install a start-on-startup user or system service via systemd, launchd, or reg.exe

func IsPrivileged

func IsPrivileged() bool

IsPrivileged returns true if we suspect that the current user (or process) will be able to write to system folders, bind to privileged ports, and otherwise successfully run a system service.

func List

func List(conf *service.Service) ([]string, []string, []error)

func Render

func Render(c *service.Service) ([]byte, error)

Render will create a systemd .service file using the simple internal template

func Run

func Run(bin string, args ...string) error

func Start

func Start(conf *service.Service) error

func Stop

func Stop(conf *service.Service) error

func WhereIs

func WhereIs(exe string) (string, error)

WhereIs uses exec.LookPath to return an absolute filepath with forward slashes

Types

type ErrDaemonize

type ErrDaemonize struct {
	DaemonArgs []string
	// contains filtered or unexported fields
}

func (*ErrDaemonize) Error

func (e *ErrDaemonize) Error() string

type File

type File interface {
	io.Closer
	io.Reader
	io.Seeker
	Readdir(count int) ([]os.FileInfo, error)
	Stat() (os.FileInfo, error)
}

File is the same as http.File

type FileSystem

type FileSystem interface {
	Open(name string) (File, error)
}

FileSystem is the same as http.FileSystem

type ManageError

type ManageError struct {
	Name   string
	Hint   string
	Parent error
}

func (*ManageError) Error

func (e *ManageError) Error() string

type Runnable

type Runnable struct {
	Exec     string
	Args     []string
	Must     bool
	Keywords []string
	Badwords []string
}

Runnable defines a command to run, along with its arguments, and whether or not failing to exit successfully matters. It also defines whether certains words must exist (or not exist) in its output, apart from existing successfully, to determine whether or not it was actually successful.

func (Runnable) Run

func (x Runnable) Run() error

func (Runnable) String

func (x Runnable) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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