Documentation ¶
Overview ¶
提供运行程序的启动、停止的框架,标准化信号拦截的运行分块。 代码是简化了“github.com/judwhite/go-svc/svc“,不再提供windows服务的特殊处理,从而不再依赖"golang.org/x/sys/windows/svc"。 如果需要可以将应用程序替换回去。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Environment ¶
type Environment interface { // IsWindowsService returns true if the program is running as a // Windows Service. IsWindowsService() bool }
Environment interface contains information about the environment your application is running in.
type Service ¶
type Service interface { // Init is called before the program/service is started and after it's // determined if the program is running as a Windows Service. Init(Environment) error // Start is called after Init. This method must be non-blocking. Start() error // Stop is called in response to os.Interrupt, os.Kill, or when a // Windows Service is stopped. Stop() error }
Service interface contains Start and Stop methods which are called when the service is started and stopped. The Init method is called before the service is started, and after it's determined if the program is running as a Windows Service.
The Start method must be non-blocking.
Implement this interface and pass it to Run to start your program.
Click to show internal directories.
Click to hide internal directories.