mindoc/main.go

42 lines
831 B
Go
Raw Normal View History

2017-04-19 18:19:27 +08:00
package main
import (
2017-05-09 18:17:08 +08:00
"fmt"
"os"
2017-05-03 15:05:01 +08:00
_ "github.com/astaxie/beego/session/memcache"
_ "github.com/astaxie/beego/session/mysql"
_ "github.com/astaxie/beego/session/redis"
_ "github.com/go-sql-driver/mysql"
"github.com/kardianos/service"
2017-06-14 09:23:29 +08:00
"github.com/lifei6671/mindoc/commands"
"github.com/lifei6671/mindoc/commands/daemon"
_ "github.com/lifei6671/mindoc/routers"
_ "github.com/mattn/go-sqlite3"
2017-04-19 18:19:27 +08:00
)
func main() {
2017-05-01 17:43:33 +08:00
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()
}
}
2017-04-21 18:20:35 +08:00
commands.RegisterCommand()
d := daemon.NewDaemon()
2017-05-01 19:12:52 +08:00
s, err := service.New(d, d.Config())
if err != nil {
fmt.Println("Create service error => ", err)
os.Exit(1)
}
s.Run()
2017-04-19 18:19:27 +08:00
}