Restart TRMM agent if it installs choco

This commit is contained in:
silversword411 2023-12-08 12:45:34 -05:00
parent f0736faf4b
commit 7e71a075c3

View file

@ -59,6 +59,15 @@ func (a *Agent) InstallChoco() {
result.Installed = true
a.rClient.R().SetBody(result).Post(url)
if result.Installed {
restartScript := "Restart-Service -Name 'tacticalrmm'"
_, _, exitcode, err := a.RunScript(restartScript, "powershell", []string{}, 60, false, []string{})
if err != nil || exitcode != 0 {
a.Logger.Debugln("Failed to restart TRMM agent service:", err)
// Handle the error or log it as required
}
}
}
func (a *Agent) InstallWithChoco(name string) (string, error) {