Add --service-display-name option for use with Windows service (#5770)
This commit is contained in:
parent
0aa25e2b6c
commit
7978ebef40
|
@ -60,6 +60,7 @@ var fUsage = flag.String("usage", "",
|
||||||
var fService = flag.String("service", "",
|
var fService = flag.String("service", "",
|
||||||
"operate on the service (windows only)")
|
"operate on the service (windows only)")
|
||||||
var fServiceName = flag.String("service-name", "telegraf", "service name (windows only)")
|
var fServiceName = flag.String("service-name", "telegraf", "service name (windows only)")
|
||||||
|
var fServiceDisplayName = flag.String("service-display-name", "Telegraf Data Collector Service", "service display name (windows only)")
|
||||||
var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)")
|
var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -352,7 +353,7 @@ func main() {
|
||||||
if runtime.GOOS == "windows" && windowsRunAsService() {
|
if runtime.GOOS == "windows" && windowsRunAsService() {
|
||||||
svcConfig := &service.Config{
|
svcConfig := &service.Config{
|
||||||
Name: *fServiceName,
|
Name: *fServiceName,
|
||||||
DisplayName: "Telegraf Data Collector Service",
|
DisplayName: *fServiceDisplayName,
|
||||||
Description: "Collects data using a series of plugins and publishes it to" +
|
Description: "Collects data using a series of plugins and publishes it to" +
|
||||||
"another series of plugins.",
|
"another series of plugins.",
|
||||||
Arguments: []string{"--config", "C:\\Program Files\\Telegraf\\telegraf.conf"},
|
Arguments: []string{"--config", "C:\\Program Files\\Telegraf\\telegraf.conf"},
|
||||||
|
|
|
@ -37,6 +37,7 @@ The commands & flags are:
|
||||||
--console run as console application (windows only)
|
--console run as console application (windows only)
|
||||||
--service <service> operate on the service (windows only)
|
--service <service> operate on the service (windows only)
|
||||||
--service-name service name (windows only)
|
--service-name service name (windows only)
|
||||||
|
--service-display-name service display name (windows only)
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
|
@ -65,5 +66,5 @@ Examples:
|
||||||
telegraf --service install --config "C:\Program Files\Telegraf\telegraf.conf"
|
telegraf --service install --config "C:\Program Files\Telegraf\telegraf.conf"
|
||||||
|
|
||||||
# install telegraf service with custom name
|
# install telegraf service with custom name
|
||||||
telegraf --service install --service-name=my-telegraf
|
telegraf --service install --service-name=my-telegraf --service-display-name="My Telegraf"
|
||||||
`
|
`
|
||||||
|
|
Loading…
Reference in New Issue