30 lines
635 B
Go
30 lines
635 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"game/server/client/config"
|
|
"game/server/client/server"
|
|
"github.com/fox/fox/log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
func initRepo() {
|
|
//model.InitRedis()
|
|
}
|
|
|
|
func Run(GitCommit, GitBranch, BuildDate string) {
|
|
config.LoadConfig(GitCommit, GitBranch, BuildDate)
|
|
log.Info(fmt.Sprintf("版本分支:%v,hash值:%v,编译时间:%v", GitBranch, GitCommit, BuildDate))
|
|
initRepo()
|
|
|
|
server.Init()
|
|
// 截获 SIGINT 和 SIGTERM 信号
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
|
sig := <-c
|
|
server.Stop()
|
|
log.Info(fmt.Sprintf("received %s, initiating shutdown...", sig))
|
|
}
|