mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 00:15:43 +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.
36 lines
760 B
Go
36 lines
760 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package command
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/hashicorp/cli"
|
|
)
|
|
|
|
type WindowsCommand struct {
|
|
Meta
|
|
}
|
|
|
|
func (c *WindowsCommand) Help() string {
|
|
helpText := `
|
|
Usage: nomad windows <subcommand> [options]
|
|
|
|
This command groups subcommands for managing Nomad as a system service on Windows.
|
|
|
|
Service::
|
|
|
|
$ nomad windows service
|
|
|
|
Refer to the individual subcommand help for detailed usage information.
|
|
`
|
|
return strings.TrimSpace(helpText)
|
|
}
|
|
|
|
func (c *WindowsCommand) Name() string { return "windows" }
|
|
|
|
func (c *WindowsCommand) Synopsis() string { return "Manage Nomad as a system service on Windows" }
|
|
|
|
func (c *WindowsCommand) Run(_ []string) int { return cli.RunResultHelp }
|