Exit after running --test without requiring --console (#5631)
This commit is contained in:
parent
be26ef6f9b
commit
c57ba6110d
|
@ -342,7 +342,7 @@ func main() {
|
||||||
log.Println("Telegraf version already configured to: " + internal.Version())
|
log.Println("Telegraf version already configured to: " + internal.Version())
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "windows" && !(*fRunAsConsole) {
|
if runtime.GOOS == "windows" && windowsRunAsService() {
|
||||||
svcConfig := &service.Config{
|
svcConfig := &service.Config{
|
||||||
Name: *fServiceName,
|
Name: *fServiceName,
|
||||||
DisplayName: "Telegraf Data Collector Service",
|
DisplayName: "Telegraf Data Collector Service",
|
||||||
|
@ -392,3 +392,16 @@ func main() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if Telegraf should create a Windows service.
|
||||||
|
func windowsRunAsService() bool {
|
||||||
|
if *fService != "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if *fRunAsConsole {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return !service.Interactive()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue