judwhite / Go Svc
Licence: mit
Go Windows Service wrapper that plays nice with Linux.
Stars: ✭ 323
Programming Languages
go
31211 projects - #10 most used programming language
Labels
Projects that are alternatives of or similar to Go Svc
server-action-service
Generic and reusable Lightning service component that calls server-side actions
Stars: ✭ 19 (-94.12%)
Mutual labels: service
prometheus-hetzner-sd
Prometheus Service Discovery for Hetzner
Stars: ✭ 15 (-95.36%)
Mutual labels: service
mangium
(Needs contributors) Service/project manager for developers/small teams
Stars: ✭ 12 (-96.28%)
Mutual labels: service
Travis Buddy
🚀 Seamless integration between TravisCI and GitHub
Stars: ✭ 262 (-18.89%)
Mutual labels: service
Cronical
.NET-based cron daemon. Can replace Windows Services and Scheduled Tasks, typically for running service-like processes as part of an application suite - or just by itself.
Stars: ✭ 42 (-87%)
Mutual labels: service
Php Ide Serenata
Atom IDE package that integrates the Serenata server to provide PHP code assistance
Stars: ✭ 277 (-14.24%)
Mutual labels: service
cyborg
Acceleration Management. Mirror of code maintained at opendev.org.
Stars: ✭ 47 (-85.45%)
Mutual labels: service
Learn-ServiceMesh-Workshop
Labs for Kubecon NA Workshop on Service Mesh with Cloud PKS
Stars: ✭ 13 (-95.98%)
Mutual labels: service
Trove
OpenStack Database As A Service (Trove). Mirror of code maintained at opendev.org.
Stars: ✭ 269 (-16.72%)
Mutual labels: service
Magnum
Container Infrastructure Management Service for OpenStack. Mirror of code maintained at opendev.org.
Stars: ✭ 289 (-10.53%)
Mutual labels: service
netlicensing.io
Labs64 NetLicensing - Innovative License Management Solution
Stars: ✭ 13 (-95.98%)
Mutual labels: service
stucco-js
GraphQL server. JavaScript runtime for stucco - GraphQL as a Service
Stars: ✭ 22 (-93.19%)
Mutual labels: service
K8sapp
Application template that satisfies the Kubernetes requirements (Golang)
Stars: ✭ 321 (-0.62%)
Mutual labels: service
Azure Service Operator
Azure Service Operator allows you to create Azure resources using kubectl
Stars: ✭ 291 (-9.91%)
Mutual labels: service
Quicklib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Config, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Stars: ✭ 274 (-15.17%)
Mutual labels: service
go-svc
Go Windows Service wrapper that plays nice with Linux. Windows tests here.
Project Status
- Used in Production.
- Maintained. Issues and Pull Requests will be responded to.
Go Modules
- Please note the
import
path andgo.mod
change fromgithub.com/judwhite/go-svc/svc
togithub.com/judwhite/go-svc
forv1.2+
-
v1.1.3
and earlier can be imported using the previous import path -
v1.2+
code is backwards compatible with previous versions
module awesomeProject
go 1.15
require github.com/judwhite/go-svc v1.2.0
import "github.com/judwhite/go-svc"
Example
package main
import (
"log"
"sync"
"github.com/judwhite/go-svc"
)
// program implements svc.Service
type program struct {
wg sync.WaitGroup
quit chan struct{}
}
func main() {
prg := &program{}
// Call svc.Run to start your program/service.
if err := svc.Run(prg); err != nil {
log.Fatal(err)
}
}
func (p *program) Init(env svc.Environment) error {
log.Printf("is win service? %v\n", env.IsWindowsService())
return nil
}
func (p *program) Start() error {
// The Start method must not block, or Windows may assume your service failed
// to start. Launch a Goroutine here to do something interesting/blocking.
p.quit = make(chan struct{})
p.wg.Add(1)
go func() {
log.Println("Starting...")
<-p.quit
log.Println("Quit signal received...")
p.wg.Done()
}()
return nil
}
func (p *program) Stop() error {
// The Stop method is invoked by stopping the Windows service, or by pressing Ctrl+C on the console.
// This method may block, but it's a good idea to finish quickly or your process may be killed by
// Windows during a shutdown/reboot. As a general rule you shouldn't rely on graceful shutdown.
log.Println("Stopping...")
close(p.quit)
p.wg.Wait()
log.Println("Stopped.")
return nil
}
More Examples
See the example directory for more examples, including installing and uninstalling binaries built in Go as Windows services.
Similar Projects
License
go-svc
is under the MIT license. See the LICENSE file for details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].