forked from kardianos/service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
opsrampchanges.txt
59 lines (43 loc) · 1.52 KB
/
opsrampchanges.txt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Changes in service package:
--------------------------
1. in service_systemd_linux.go file
-- In Uninstall() fucntion added below lines and commented return err lines
//Remove/stop agent
run("systemctl", "stop", s.Name+".service")
2. in service_sysv_linux.go file
-- In Uninstall() fucntion added below lines and commented existing lines of code
run("/sbin/chkconfig", "--del", s.Name)
/*cp, err := s.configPath()
if err != nil {
return err
}
if err := os.Remove(cp); err != nil {
return err
}*/
//removing old service log files
os.Remove("/var/log/" + s.Name + ".log")
os.Remove("/var/log/" + s.Name + ".err")
//removing service log files
os.Remove("/var/log/opsramp/" + s.Name + ".log")
os.Remove("/var/log/opsramp/" + s.Name + ".err")
-- Changes in init script, creating service og files in /var/log/opsramp folder instead of /var/log
stdout_log="/var/log/opsramp/$name.log"
stderr_log="/var/log/opsramp/$name.err"
$name Running
$name Stopped
3. in service_upstart_linux.go file
-- In isUpstart() fuction added below code
if strings.Contains(string(out), "init (upstart") {
re := regexp.MustCompile("[0-9]+")
s := re.FindAllString(string(strings.Split(string(out), "\n")[0]), -1)
first_digit, _ := strconv.Atoi(s[0])
second_digit, _ := strconv.Atoi(s[1])
if second_digit >= 4 {
if first_digit >= 1 {
return true
} else {
return false
}
}
-- In Uninstall() function added below line and commented return err lines
run("initctl", "stop", s.Name)