forked from LockGit/gochat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (44 loc) · 862 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
/**
* Created by lock
* Date: 2019-08-09
* Time: 10:56
*/
package main
import (
"flag"
"fmt"
"gochat/api"
"gochat/connect"
"gochat/logic"
"gochat/site"
"gochat/task"
"os"
"os/signal"
"syscall"
)
func main() {
var module string
flag.StringVar(&module, "module", "", "assign run module")
flag.Parse()
fmt.Println(fmt.Sprintf("start run %s module", module))
switch module {
case "logic":
logic.New().Run()
case "connect":
connect.New().Run()
case "task":
task.New().Run()
case "api":
api.New().Run()
case "site":
site.New().Run()
default:
fmt.Println("exiting,module param error!")
return
}
fmt.Println(fmt.Sprintf("run %s module done!", module))
quit := make(chan os.Signal)
signal.Notify(quit, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGTSTP)
<-quit
fmt.Println("Server exiting")
}