-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
31 lines (27 loc) · 832 Bytes
/
main.go
File metadata and controls
31 lines (27 loc) · 832 Bytes
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
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/easy-oj/common/logs"
"github.com/easy-oj/common/settings"
"github.com/easy-oj/queue/initial"
)
func main() {
var confPath, logsPath string
flag.StringVar(&confPath, "conf", "/etc/eoj/settings.yaml", "Path of config file, default /etc/eoj/settings.yaml")
flag.StringVar(&logsPath, "logs", "", "Path of logs file, default stdout")
flag.Parse()
settings.InitSettings(confPath)
logs.InitLogs(logsPath)
if bs, err := json.Marshal(settings.Settings); err == nil {
logs.Info("[Main] Loaded settings: %s", string(bs))
}
initial.Initialize()
ch := make(chan os.Signal)
signal.Notify(ch, syscall.SIGHUP, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM)
_, _ = fmt.Fprintf(os.Stderr, "Received signal %v, exit...\n", <-ch)
}