File tree 2 files changed +15
-7
lines changed
2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ program "consul" {
4
4
}
5
5
6
6
program "nomad" {
7
- command = " nomad agent -dev"
8
- check = " nomad node status"
9
- # seconds = 1 # to test check failures
7
+ command = " nomad agent -dev"
8
+ check = " nomad node status"
9
+ # seconds = 3 # to test check failures
10
10
}
11
11
12
12
program "vault" {
Original file line number Diff line number Diff line change @@ -2,8 +2,11 @@ package main
2
2
3
3
import (
4
4
"context"
5
+ "fmt"
5
6
"log"
6
7
"os"
8
+ "os/signal"
9
+ "syscall"
7
10
8
11
"github.com/gulducat/go-run-programs/program"
9
12
)
@@ -14,17 +17,22 @@ func main() {
14
17
15
18
func CLI (args []string ) int {
16
19
if len (args ) < 2 {
17
- log .Println ("gotta provide an hcl file ok?" )
20
+ fmt .Println ("gotta provide an hcl file ok?" )
18
21
return 1
19
22
}
20
23
24
+ sig := make (chan os.Signal , 1 )
25
+ signal .Notify (sig , os .Interrupt , syscall .SIGTERM )
26
+
21
27
stop , err := program .RunFromHCL (context .Background (), args [1 ])
22
28
defer stop ()
29
+
23
30
if err != nil {
24
- log .Println ("error:" , err )
31
+ fmt .Println ("error:" , err )
25
32
return 1
26
33
}
27
34
28
- // let the good times roll
29
- select {}
35
+ s := <- sig
36
+ log .Println ("signal:" , s )
37
+ return 0
30
38
}
You can’t perform that action at this time.
0 commit comments