Skip to content

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

License

Notifications You must be signed in to change notification settings

codemodify/systemkit-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages