From 5fe6a9a1d2fb748b87c75717ded2e4524ea88a84 Mon Sep 17 00:00:00 2001 From: Josh Powers Date: Thu, 21 Mar 2024 10:35:59 -0600 Subject: [PATCH] fix(windows): Ensure watch-config is passed to service fixes: #14696 --- cmd/telegraf/telegraf_windows.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/telegraf/telegraf_windows.go b/cmd/telegraf/telegraf_windows.go index 5b50484e87a19..4fba41eea1d51 100644 --- a/cmd/telegraf/telegraf_windows.go +++ b/cmd/telegraf/telegraf_windows.go @@ -128,6 +128,10 @@ func (t *Telegraf) runAsWindowsService() error { svcConfig.Arguments = append(svcConfig.Arguments, "--config-directory", fConfigDirectory) } + if t.watchConfig != "" { + svcConfig.Arguments = append(svcConfig.Arguments, "--watch-config", t.watchConfig) + } + //set servicename to service cmd line, to have a custom name after relaunch as a service svcConfig.Arguments = append(svcConfig.Arguments, "--service-name", t.serviceName)