-
Notifications
You must be signed in to change notification settings - Fork 22
/
agenthandle_unix.go
40 lines (34 loc) · 1.09 KB
/
agenthandle_unix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//go:build linux || freebsd
// +build linux freebsd
package kickvmhandle
import (
"path/filepath"
"strings"
"github.com/aliyun/aliyun_assist_client/agent/log"
"github.com/aliyun/aliyun_assist_client/agent/util/process"
"github.com/aliyun/aliyun_assist_client/common/pathutil"
)
func stopAgant(params []string) error {
log.GetLogger().Println("stopAgant")
processer := process.ProcessCmd{}
processer.SyncRunSimple("aliyun-service", strings.Split("--stop", " "), 10)
return nil
}
func removeAgant(params []string) error {
log.GetLogger().Println("removeAgant")
processer := process.ProcessCmd{}
processer.SyncRunSimple("aliyun-service", strings.Split("--remove", " "), 10)
processer.SyncRunSimple("aliyun-service", strings.Split("--stop", " "), 10)
return nil
}
func updateAgant(params []string) error {
log.GetLogger().Println("updateAgant")
processer := process.ProcessCmd{}
path, err := pathutil.GetCurrentPath()
if err != nil {
return err
}
path = filepath.Join(path, "aliyun_assist_update")
processer.SyncRunSimple(path, strings.Split("--check_update", " "), 10)
return nil
}