All Projects → billgraziano → go-windows-svc

billgraziano / go-windows-svc

Licence: other
GO shell for a Windows service

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to go-windows-svc

suchtube
🔍 📼 YouTube search as a service, with Slack integration and CLI
Stars: ✭ 25 (-56.14%)
Mutual labels:  service
ApiCenter
A repository for all your API specifications
Stars: ✭ 26 (-54.39%)
Mutual labels:  service
login-server
Login and connect accounts with multiple identity providers
Stars: ✭ 28 (-50.88%)
Mutual labels:  service
origami-image-service
Optimises and resizes images
Stars: ✭ 15 (-73.68%)
Mutual labels:  service
MusicPlayer
Android music player example.
Stars: ✭ 20 (-64.91%)
Mutual labels:  service
HiveMind
HiveMind is a project management and ERP application for services organizations. It features project/task management, request tracking, time tracking, expenses, invoices/payments, general ledger, and content management (wiki). HiveMind is based on Moqui Framework, Mantle Business Artifacts, and Simple Screens.
Stars: ✭ 40 (-29.82%)
Mutual labels:  service
ex aws s3
No description or website provided.
Stars: ✭ 121 (+112.28%)
Mutual labels:  service
TgTwitterStreamer
Continous Integration from Twitter to Telegram.
Stars: ✭ 55 (-3.51%)
Mutual labels:  service
UnSupportedServices.bundle
UnSupported Services.bundle for Plex Media Server (https://plex.tv)
Stars: ✭ 18 (-68.42%)
Mutual labels:  service
impress-cli
Impress Application Server Command line interface
Stars: ✭ 25 (-56.14%)
Mutual labels:  service
xtuff
A CLI to generate stuff easy! (components, services, etc...)
Stars: ✭ 28 (-50.88%)
Mutual labels:  service
CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Stars: ✭ 57 (+0%)
Mutual labels:  service
Nano.Library
Take full advantage of Nano Library, and rapidly implement enriched .Net 6.0 micro-services.
Stars: ✭ 39 (-31.58%)
Mutual labels:  service
dynamic-engine
Monitor events in the background on Android.
Stars: ✭ 24 (-57.89%)
Mutual labels:  service
ng2-STOMP-Over-WebSocket
STOMP Over WebSocket service for angular2
Stars: ✭ 35 (-38.6%)
Mutual labels:  service
json-resume-service
JSON resumes as a Service - generate Resumes from the resume.json schema
Stars: ✭ 41 (-28.07%)
Mutual labels:  service
wulaphp
一个有点复杂的PHP框架!
Stars: ✭ 26 (-54.39%)
Mutual labels:  service
elixir-ms
an elixir microservice base/skeleton 💀
Stars: ✭ 39 (-31.58%)
Mutual labels:  service
gologger
A concurrent, fast queue/service worker based filesystem logging system perfect for servers with concurrent connections
Stars: ✭ 16 (-71.93%)
Mutual labels:  service
muse-as-service
REST API for sentence tokenization and embedding using Multilingual Universal Sentence Encoder.
Stars: ✭ 45 (-21.05%)
Mutual labels:  service

GO Windows Service Shell

This is based on the GO Windows service example program provided by the GO Project. It is a project shell to create a Windows service.

Getting Started

The program compiles and runs on GO 1.8. The generated executable accepts a single parameter. The parameter values include:

  • debug - runs the program from the command-line
  • install - installs a windows service
  • remove - removes the windows service
  • start
  • stop
  • pause
  • continue

Installing and Updating a Service

After compiling an executable, the service can be installed from an Administrative command prompt. Typing

YourExecutable.EXE install 

will install the service.

To update the service, stop the service, replace the executble and restart the service.

The service can be removed from an Administrative command prompt by typing:

YourExecutable.EXE remove 

Customizing

The code exists in two packabages

  • cmd/gosvc - Wrapper to control the service
  • app - Your application

All service boilerplate code is in the four files in cmd/gosvc with a "svc_" prefix. There should be no need to modify this code.

The only code you should need to change is in main.go.

  • Replace the import of github.com/billgraziano/go-windows-svc/app with the path to your package.
  • svcName - This constant is the name of the installed service. This is used for NET START and NET STOP commands.
  • svcNameLong - This is the longer service name that appears in the Services control panel.
  • svcLauncher() - This launches app.Run passing it a Windows Event Logger, the svcName, and the SHA1 hash from GIT.

You should also rename the gosvc directory to the name of your executable.

  • setup() - This function is called to do any application setup. If returns a non-nil error, the service will exit.
  • yourApp() - This is launched as a GO routine. This is the body of your application. Here you can launch web servers, listeners, or whatever your application does.

Advanced

Logging

The server struct exposes a winlog variable that is a logger. This will write to the console when running interactively and to the Winodws Application Event Log when running as a service. I typically use this for any service errors, start and stop notification, and any issues reading configuration or setting up logging.

Other

This uses the GO error wrapper package. You can easily remove it if you prefer not to use it.

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].