Add ability to define a custom service name when installing as a Windows service (#4753)

This commit is contained in:
Lee Jaeyong
2018-09-28 10:41:24 +09:00
committed by Daniel Nelson
parent 008ee617cb
commit 6b7d64f1d6
3 changed files with 16 additions and 1 deletions

View File

@@ -55,6 +55,7 @@ var fUsage = flag.String("usage", "",
"print usage for a plugin, ie, 'telegraf --usage mysql'")
var fService = flag.String("service", "",
"operate on the service (windows only)")
var fServiceName = flag.String("service-name", "telegraf", "service name (windows only)")
var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)")
var (
@@ -327,7 +328,7 @@ func main() {
if runtime.GOOS == "windows" && !(*fRunAsConsole) {
svcConfig := &service.Config{
Name: "telegraf",
Name: *fServiceName,
DisplayName: "Telegraf Data Collector Service",
Description: "Collects data using a series of plugins and publishes it to" +
"another series of plugins.",