/systemkit-service

Cross platform Create/Start/Stop/Delete system or user service

Primary LanguageGoOtherNOASSERTION

Service

What

Robust cross platform CREATE / DELETE / START / STOP / QUERY system service for Go

This repo is a cross platform reference implementation of the SERVICE spec

References

   
Spec for portable SERVICE https://github.com/codemodify/systemkit-service-spec
Command line tool https://github.com/codemodify/systemkit-service-cli
Samples & Tests https://github.com/codemodify/systemkit-service-tests
Init Frameworks https://github.com/codemodify/systemkit-service-encoders-rc_d
  https://github.com/codemodify/systemkit-service-encoders-launchd
  https://github.com/codemodify/systemkit-service-encoders-systemd
  https://github.com/codemodify/systemkit-service-encoders-systemv
  https://github.com/codemodify/systemkit-service-encoders-upstart

How

go get github.com/codemodify/systemkit-service
~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~ ~~~~
func main() {
  mySrevice := service.NewServiceFromConfig(service.Config{
  	Name:               "test-service",
  	Description:        "Test Service",
  	Executable:         "/bin/sleep",
  	Args:               []string{"40"},
  	WorkingDirectory:   "/tmp",
  	Restart:            true,
  	DelayBeforeRestart: 10,
  	StdOut: service.LogConfig{
  		Disable: true,
  	},
  	StdErr: service.LogConfig{
  		Disable: true,
  	},
  })

  err := mySrevice.Install()
  if err != nil {
  	fmt.Println(err.String())
  }
}
API  
Install() Installs the service
Uninstall() Deletes the service
Start() Starts the service
Stop() Stops the service
Info() Queries the service
___ ___
NewServiceFromSERVICE() Service from portable SERVICE definition
NewServiceFromName() Service by finding in the system using its name
NewServiceFromPlatformTemplate() Service from a platform dependent template

Support

    100% in progress
systemd
rc.d
procd
sysvinit
launchd
Service Control Manager
cygserver
OpenRC
Shepherd
Mudur
init
cinit
runit
minit
Initng Berry Linux
Android Init
UpStart
Service Management Facility