增加service命令

This commit is contained in:
GoEdgeLab
2021-01-12 11:49:14 +08:00
parent 27e3a7badb
commit 5437fdcdae
9 changed files with 594 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ func main() {
app := apps.NewAppCmd()
app.Version(teaconst.Version)
app.Product(teaconst.ProductName)
app.Usage(teaconst.ProcessName + " [start|stop|restart|setup|upgrade]")
app.Usage(teaconst.ProcessName + " [start|stop|restart|setup|upgrade|service|daemon]")
app.On("setup", func() {
setupCmd := setup.NewSetupFromCmd()
err := setupCmd.Run()
@@ -56,6 +56,16 @@ func main() {
}
fmt.Println("finished!")
})
app.On("daemon", func() {
nodes.NewAPINode().Daemon()
})
app.On("service", func() {
err := nodes.NewAPINode().InstallSystemService()
if err != nil {
fmt.Println("[ERROR]install failed: " + err.Error())
}
fmt.Println("done")
})
app.Run(func() {
nodes.NewAPINode().Start()
})