forked from filecoin-box/robin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (43 loc) · 960 Bytes
/
main.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
45
46
47
48
49
50
51
52
package main
import (
lcli "github.com/filecoin-project/lotus/cli"
logging "github.com/ipfs/go-log/v2"
"github.com/luluup777/robin/modules"
"github.com/luluup777/robin/parse"
"github.com/urfave/cli/v2"
"os"
"os/signal"
"syscall"
)
var log = logging.Logger("robin")
func main() {
_ = logging.SetLogLevel("*", "INFO")
app := &cli.App{
Name: "robin",
Usage: "mining monitoring and alarm",
Version: "v0.1",
EnableBashCompletion: true,
Commands: []*cli.Command{
run,
},
}
app.Setup()
lcli.RunApp(app)
}
var run = &cli.Command{
Name: "run",
Usage: "start robin",
Before: func(context *cli.Context) error {
parse.Init()
return nil
},
Action: func(cctx *cli.Context) error {
log.Info("robin start")
go modules.StartMonitor()
quit := make(chan os.Signal)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
log.Info("robin shutting down")
return nil
},
}