-
Notifications
You must be signed in to change notification settings - Fork 60
/
signal_windows.go
44 lines (39 loc) · 945 Bytes
/
signal_windows.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
41
42
43
44
//go:build windows
// +build windows
package main
import (
"os"
"os/signal"
"syscall"
"github.com/go-kit/log/level"
)
func reloadSignal() {
// Signal handling
hup := make(chan os.Signal, 1)
signal.Notify(hup, syscall.SIGHUP)
go func() {
for {
select {
case <-hup:
level.Debug(logger).Log("msg", "Signal: HUP")
level.Info(logger).Log("msg", "ReLoading config")
if err := sc.ReloadConfig(logger, *configFile); err != nil {
level.Error(logger).Log("msg", "Reloading config skipped", "err", err)
continue
} else {
monitorPING.DelTargets()
_ = monitorPING.CheckActiveTargets()
monitorPING.AddTargets()
monitorMTR.DelTargets()
_ = monitorMTR.CheckActiveTargets()
monitorMTR.AddTargets()
monitorTCP.DelTargets()
_ = monitorTCP.CheckActiveTargets()
monitorTCP.AddTargets()
monitorHTTPGet.DelTargets()
monitorHTTPGet.AddTargets()
}
}
}
}()
}