Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
/ go-daemon Public archive

A daemon package for use with Go services without any dependencies (except for `golang.org/x/sys/windows`)

License

Notifications You must be signed in to change notification settings

nsemikov/go-daemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-daemon

License pkg.go.dev reference Build Status Go Report Card Coverage Release

Logo

A daemon package for use with Go services without any dependencies (except for golang.org/x/sys/windows)

Features

  • Use install and uninstall service file on Linux (SystemD, SystemV, UpStart), MacOS and FreeBSD
  • More control: start, stop, restart, reload for all supported OS and pause and continue for Windows
  • Unified interface for all supported OS

Install

go get -u github.com/nsemikov/go-daemon@latest

Usage

Create config for daemon:

cfg := daemon.NewConfig(
  daemon.WithName("cmd_example"),
  daemon.WithDescription("Command Line daemon example"),
  daemon.WithStartHdlr(start),
  daemon.WithStopHdlr(stop),
  // add more options if you need
)

Create daemon:

d, err := daemon.New(cfg)

And then run it:

err = d.Run()

See the examples directory for more complete examples.

About

A daemon package for use with Go services without any dependencies (except for `golang.org/x/sys/windows`)

Resources

License

Stars

Watchers

Forks

Languages