mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(host-deployer): windows 2008 Out-File IOException
debug log cause windows 2008 IOException, multi process open log file.
This commit is contained in:
@@ -595,7 +595,7 @@ func (w *SWindowsRootFs) DeployTelegraf(config string) (bool, error) {
|
||||
strings.Join([]string{
|
||||
`%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`,
|
||||
` -executionpolicy bypass %SystemRoot%\telegraf.ps1`,
|
||||
fmt.Sprintf(" '%s' '%s' %s", telegrafBinaryPath, telegrafConfPath, w.guestDebugLogPath),
|
||||
fmt.Sprintf(" '%s' '%s' >> %s_telegraf", telegrafBinaryPath, telegrafConfPath, w.guestDebugLogPath),
|
||||
}, ""),
|
||||
`del %SystemRoot%\telegraf.ps1`,
|
||||
w.MakeGuestDebugCmd("setup telegraf step 2"),
|
||||
|
||||
@@ -522,14 +522,8 @@ mtw_main();
|
||||
const winTelegrafSetupPowerShellScript = `
|
||||
$telegraf = $args[0]
|
||||
$telegraf_conf = $args[1]
|
||||
$logpath = $args[2]
|
||||
|
||||
if ($logpath) {
|
||||
& $telegraf --service install --config $telegraf_conf 2>&1 | Out-File $logpath -Append -Encoding Default
|
||||
net start telegraf | Out-File $logpath -Append -Encoding Default
|
||||
} else {
|
||||
& $telegraf --service install --config $telegraf_conf 2>&1
|
||||
net start telegraf
|
||||
}
|
||||
& $telegraf --service install --config $telegraf_conf
|
||||
net start telegraf
|
||||
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user