service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	GracefulExitTimeout    = 10 * time.Second
	GracefulExitTimeoutErr = errors.New("graceful stop time exceeded... forcing stop")
)

Functions

func GetCommandPath

func GetCommandPath(svcCmd string) string

GetCommandPath returns the absolute path of the agent binary that should be run.

func New

func New(arg ...string) (service.Service, error)

func WaitForExitOrTimeout

func WaitForExitOrTimeout(exitCode <-chan int) error

Types

type Service

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

Service is a wrapper object which provides the necessary hooks to start/stop the agent as a service

func (*Service) Shutdown

func (svc *Service) Shutdown(_ service.Service) (err error)

Shutdown is called in Windows only, when the machine is shutting down

func (*Service) Start

func (svc *Service) Start(s service.Service) (err error)

Start is called when the service manager tells us to start

func (*Service) Stop

func (svc *Service) Stop(_ service.Service) (err error)

Stop is called when the service manager commands us to stop By default systemD sends the SIGTERM signal to all the subprocesses, so the agent (child) process will have to handle it in order to property stop (otherwise it just gets killed 'immediately')

Jump to

Keyboard shortcuts

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