forked from phper-hejing/insane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (35 loc) · 823 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
package main
import (
"fmt"
"github.com/donnie4w/go-logger/logger"
"insane/general/base/appconfig"
"insane/general/insane"
"insane/server"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
)
func main() {
logger.Info("insane server ready")
if err := appconfig.InitConfig("./config/app.toml"); err != nil {
logger.Debug("insane server error ", err)
}
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGPIPE)
//open a task
go server.TK.TaskListRun()
//configure http server
go insane.OnStart()
//open listen server
go server.InsaneLoad.Start(3)
logger.Debug("insane server starting ")
for {
a := <-signalChan
fmt.Println(a)
if a != syscall.SIGPIPE {
break
}
}
logger.Debug("insane server stop ")
}