Restart TRMM agent if it installs choco
This commit is contained in:
parent
f0736faf4b
commit
7e71a075c3
1 changed files with 9 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue