1.4.5.2
This commit is contained in:
36
EdgeReporter/cmd/edge-reporter/main.go
Normal file
36
EdgeReporter/cmd/edge-reporter/main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/TeaOSLab/EdgeReporter/internal/apps"
|
||||
teaconst "github.com/TeaOSLab/EdgeReporter/internal/const"
|
||||
"github.com/TeaOSLab/EdgeReporter/internal/nodes"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := apps.NewAppCmd().
|
||||
Version(teaconst.Version).
|
||||
Product(teaconst.ProductName).
|
||||
Usage(teaconst.ProcessName + " [-v|start|stop|restart|service|daemon]")
|
||||
app.On("daemon", func() {
|
||||
nodes.NewReportNode().Daemon()
|
||||
})
|
||||
app.On("service", func() {
|
||||
err := nodes.NewReportNode().InstallSystemService()
|
||||
if err != nil {
|
||||
fmt.Println("[ERROR]install failed: " + err.Error())
|
||||
return
|
||||
}
|
||||
fmt.Println("done")
|
||||
})
|
||||
app.On("run", func() {
|
||||
reporterNode := nodes.NewReportNode()
|
||||
reporterNode.Run()
|
||||
})
|
||||
app.Run(func() {
|
||||
reporterNode := nodes.NewReportNode()
|
||||
reporterNode.Run()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user