mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Adds a new `windows` command which is available when running on a Windows hosts. The command includes two new subcommands: * `service install` * `service uninstall` The `service install` command will install the called binary into the Windows program files directory, create a new Windows service, setup configuration and data directories, and register the service with the Window eventlog. If the service and/or binary already exist, the service will be stopped, service and eventlog updated if needed, binary replaced, and the service started again. The `service uninstall` command will stop the service, remove the Windows service, and deregister the service with the eventlog. It will not remove the configuration/data directory nor will it remove the installed binary.
42 lines
874 B
Go
42 lines
874 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package command
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/hashicorp/cli"
|
|
)
|
|
|
|
type WindowsServiceCommand struct {
|
|
Meta
|
|
}
|
|
|
|
func (c *WindowsServiceCommand) Help() string {
|
|
helpText := `
|
|
Usage: nomad windows service <subcommand> [options]
|
|
|
|
This command groups subcommands for managing Nomad as a system service on Windows.
|
|
|
|
Install:
|
|
|
|
$ nomad windows service install
|
|
|
|
Uninstall:
|
|
|
|
$ nomad windows service uninstall
|
|
|
|
Refer to the individual subcommand help for detailed usage information.
|
|
`
|
|
return strings.TrimSpace(helpText)
|
|
}
|
|
|
|
func (c *WindowsServiceCommand) Name() string { return "windows service" }
|
|
|
|
func (c *WindowsServiceCommand) Synopsis() string {
|
|
return "Manage nomad as a system service on Windows"
|
|
}
|
|
|
|
func (c *WindowsServiceCommand) Run(_ []string) int { return cli.RunResultHelp }
|