winservice

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 7 Imported by: 0

README

winservice

Windows Service utility for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallService

func InstallService(name, display, desc string, args ...string) error

InstallService installs a windows service with the given name, display name, description and arguments

func IsWindowsService

func IsWindowsService() (bool, error)

IsWindowsService reports whether the process is running as a Windows service.

func RemoveService

func RemoveService(name string) error

RemoveService uninstalls a service with the given name

func Start

func Start(ctx context.Context, name string, job Job) error

Start launches the Windows service and executes job in a separate goroutine.

Types

type Job

type Job interface {
	// Run should block until complete after cancelation.  The process may
	// terminate before Run completes if the job takes too long to return after
	// context is canceled. Non-nil error will be logged to service Event Log
	// unless the error is context.Canceled.
	Run(context.Context) error
}

Jump to

Keyboard shortcuts

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