@@ -21,14 +21,15 @@ var (
21
21
22
22
func waitForTerm (sigChan <- chan os.Signal ) {
23
23
<- sigChan
24
- fmt .Println ("\r \n 👋" )
25
24
26
25
if config .MonitorWebhook != "" {
27
26
hook := exec .Command ("curl" , "-H" , "Content-type: application/json" , "-d" , `{"content": "stopped monitoring"}` ,
28
27
config .MonitorWebhook )
29
28
hook .Run ()
30
29
}
31
30
31
+ fmt .Println ("\r \n 👋" )
32
+
32
33
os .Exit (0 )
33
34
}
34
35
@@ -138,6 +139,15 @@ func Monitor(args []string) {
138
139
139
140
fmt .Printf (theme .ColorGray + "interval: " + theme .ColorYellow + "%v seconds" + theme .ColorReset + "\n " , montitorScanInterval )
140
141
142
+ if config .MonitorWebhook != "" {
143
+ msg := fmt .Sprintf (`{"content": "starting monitoring: %s"}` , serverAddress )
144
+ hook := exec .Command ("curl" , "-H" , "Content-type: application/json" , "-d" , msg ,
145
+ config .MonitorWebhook )
146
+ hook .Run ()
147
+ }
148
+
149
+ time .Sleep (time .Second * 5 )
150
+
141
151
sigChan := make (chan os.Signal , 1 )
142
152
signal .Notify (sigChan , os .Interrupt , syscall .SIGTERM )
143
153
@@ -148,13 +158,6 @@ func Monitor(args []string) {
148
158
fmt .Printf (theme .ColorGray + "starting scan: " + theme .ColorReset + "%v\n " , time .Now ().UTC ())
149
159
fmt .Println (theme .ColorPurple + "press " + theme .ColorCyan + "ctrl+c " + theme .ColorPurple + "to exit..." + theme .ColorReset )
150
160
151
- if config .MonitorWebhook != "" {
152
- msg := fmt .Sprintf (`{"content": "starting monitoring: %s"}` , serverAddress )
153
- hook := exec .Command ("curl" , "-H" , "Content-type: application/json" , "-d" , msg ,
154
- config .MonitorWebhook )
155
- hook .Run ()
156
- }
157
-
158
161
go monitorSpinner ()
159
162
160
163
select {}
0 commit comments