Changes made :

1. Website
Changed some of the wordings and reorganized the content of the website.
2. Code:
Removed sleep and exit lines from the code.
This commit is contained in:
Siva 2018-06-28 21:18:14 -04:00
parent dc72945380
commit 6f22474661
3 changed files with 16 additions and 18 deletions

View file

@ -134,7 +134,7 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) {
shutdownCh: make(chan struct{}), shutdownCh: make(chan struct{}),
} }
c.rpcLimiter.Store(rate.NewLimiter(config.RPCRate, config.RPCMaxBurst)) c.rpcLimiter.Store(rate.NewLimiter(config.RPCRate, config.RPCMaxBurst))
if err := c.initEnterprise(); err != nil { if err := c.initEnterprise(); err != nil {
c.Shutdown() c.Shutdown()

View file

@ -4,8 +4,6 @@ package service_os
import ( import (
wsvc "golang.org/x/sys/windows/svc" wsvc "golang.org/x/sys/windows/svc"
"os"
"time"
) )
type serviceWindows struct{} type serviceWindows struct{}
@ -20,8 +18,6 @@ func init() {
} }
go func() { go func() {
_ = wsvc.Run("", serviceWindows{}) _ = wsvc.Run("", serviceWindows{})
time.Sleep(4 * time.Second)
os.Exit(0)
}() }()
} }

View file

@ -3,7 +3,7 @@ layout: "docs"
page_title: "Windows Service" page_title: "Windows Service"
sidebar_current: "docs-guides-windows-service" sidebar_current: "docs-guides-windows-service"
description: |- description: |-
For our friends running Consul on Windows, we have good news. By using the _sc_ command either on Powershell or By using the _sc_ command either on Powershell or
the Windows command line, you can make Consul run as a service. For more details about the _sc_ command the Windows command line, you can make Consul run as a service. For more details about the _sc_ command
the Windows page for [sc](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx) the Windows page for [sc](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx)
should help you get started. should help you get started.
@ -11,24 +11,23 @@ description: |-
--- ---
# Overview # Overview
For our friends running Consul on Windows, we have good news. By using the _sc_ command either on Powershell or By using the _sc_ command either on Powershell or
the Windows command line, you can make Consul run as a service. For more details about the _sc_ command the Windows command line, you can make Consul run as a service. For more details about the _sc_ command
the Windows page for [sc](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx) the Windows page for [sc](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx)
should help you get started. should help you get started.
Please remember to create a permanent directory for storing the configuration files, Please remember to create a permanent directory for storing the configuration files. It is always
as it would be handy, if you're starting Consul with the _-config-dir_ argument. advisable to start Consul with the _-config-dir_ option.
The steps presented here assume, that the user has launched **Powershell** with _Adminstrator_ capabilities. The steps presented here , we assume that the user has launched Powershell with _Adminstrator_ capabilities.
If you come across bugs while using Consul for Windows, do not hesitate to open an issue [here](https://github.com/hashicorp/consul/issues). ## Running Consul run as a service on Windows
### Installing Consul as a Service
## Detailed steps involved in making Consul run as a service on Windows
Download the Consul binary for your architecture. Download the Consul binary for your architecture.
Setup your environmental _path_ variable, so that Windows can find Use the _sc_ command to create a Service named **Consul**, which starts in the _dev_ mode.
the Consul binary. (Will be handy for quick Consul commands)
Use the _sc_ command to create a Service named **Consul**, which starts in the _dev_ mode.
```text ```text
sc.exe create "Consul" binPath="Path to the Consul.exe arg1 arg2 ...argN" sc.exe create "Consul" binPath="Path to the Consul.exe arg1 arg2 ...argN"
@ -44,7 +43,10 @@ Use the _sc_ command to create a Service named **Consul**, which starts in the _
you have specified the proper path to the binary and check if you've entered the arguments correctly for the Consul you have specified the proper path to the binary and check if you've entered the arguments correctly for the Consul
service. service.
After this step there are two ways to start the service:
### Running Consul as a service
You have two ways to start the service.
* Go to the Windows Service Manager, and look for **Consul** under the * Go to the Windows Service Manager, and look for **Consul** under the
service name. Click the _start_ button to start the service. service name. Click the _start_ button to start the service.
@ -64,6 +66,6 @@ After this step there are two ways to start the service:
PID : 8008 PID : 8008
FLAGS : FLAGS :
``` ```
If you followed the steps above, congratulations, you have successful made Consul
run as a service on Windows. The service automatically starts up during/after boot, so you don't need to The service automatically starts up during/after boot, so you don't need to
launch Consul from the command-line again. launch Consul from the command-line again.