48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/fox/fox/log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
// func initLog(command *config.Command) {
|
|
// log.Open(fmt.Sprintf("%v/%v/%v.log", command.LogPath, servername.Money, servername.Money), command.LogLevel)
|
|
// }
|
|
|
|
func initLog() {
|
|
log.Open("hilo.log", log.DebugL)
|
|
}
|
|
|
|
func initRepo() {
|
|
// model.InitUserDB(&config.Config.DBConfig)
|
|
// model.InitConfigDB(&config.Config.DBConfig)
|
|
// model.InitRedis(&config.Config.Redis)
|
|
// model.InitStub()
|
|
// RobotMgr.Load()
|
|
// ClubRobotMgr.Load()
|
|
// //log.Debug(fmt.Sprintf("%+v", stub.GGlobal))
|
|
}
|
|
|
|
func Run(version string) {
|
|
// command := config.ParseCommand()
|
|
// initLog(command)
|
|
initLog()
|
|
log.Info(fmt.Sprintf("版本信息.%v", version))
|
|
// err := config.Load(command.ConfigPath)
|
|
// if err != nil {
|
|
// log.Error(fmt.Sprintf("load config err: %v", err))
|
|
// }
|
|
// initRepo()
|
|
|
|
// handler.InitService()
|
|
// 截获 SIGINT 和 SIGTERM 信号
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
|
sig := <-c
|
|
// handler.StopService()
|
|
log.Info(fmt.Sprintf("received %s, initiating shutdown...", sig))
|
|
}
|