-
Notifications
You must be signed in to change notification settings - Fork 803
/
main.go
42 lines (35 loc) · 924 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
package main
import (
"fmt"
"os"
"github.com/TruthHun/BookStack/utils"
"github.com/astaxie/beego"
"github.com/TruthHun/BookStack/commands"
"github.com/TruthHun/BookStack/commands/daemon"
_ "github.com/TruthHun/BookStack/routers"
_ "github.com/go-sql-driver/mysql"
"github.com/kardianos/service"
)
func main() {
// https://beego.me/docs/mvc/controller/config.md#app-%E9%85%8D%E7%BD%AE
beego.BConfig.MaxMemory = 1 << 26 * 1024 // 设置最大内存,64GB
if len(os.Args) >= 3 && os.Args[1] == "service" {
if os.Args[2] == "install" {
daemon.Install()
} else if os.Args[2] == "remove" {
daemon.Uninstall()
} else if os.Args[2] == "restart" {
daemon.Restart()
}
}
commands.RegisterCommand()
d := daemon.NewDaemon()
s, err := service.New(d, d.Config())
if err != nil {
fmt.Println("Create service error => ", err)
os.Exit(1)
}
utils.PrintInfo()
utils.InitVirtualRoot()
s.Run()
}