forked from shuimuliang/qnmahjongserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
executable file
·53 lines (46 loc) · 779 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
53
package main
import (
"fmt"
"qnmahjong/cmd"
"qnmahjong/cron"
"qnmahjong/db"
"qnmahjong/logic"
"qnmahjong/login"
"qnmahjong/pay"
"qnmahjong/redis"
"qnmahjong/sale"
"qnmahjong/tool"
"qnmahjong/util"
"os"
"os/signal"
"syscall"
)
var (
branch = "v0.0.1"
commit = "not set"
)
func main() {
defer util.Stack()
cmd.SetBranchCommit(branch, commit)
go cmd.Execute()
sigs := make(chan os.Signal, 1)
done := make(chan bool, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
go func() {
sig := <-sigs
fmt.Println()
fmt.Println(sig)
done <- true
}()
<-done
fmt.Println("exiting...")
login.Shutdown()
logic.Shutdown()
tool.Shutdown()
pay.Shutdown()
sale.Shutdown()
cron.Shutdown()
db.Shutdown()
redis.Shutdown()
fmt.Println("exited!")
}