15 Star 60 Fork 9

e9ab98e991ab / GoBooks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 659 Bytes
一键复制 编辑 原始数据 按行查看 历史
高鑫 提交于 2020-01-03 12:11 . 整合配置 设置基础版本
package main
import (
"fmt"
"gitee.com/Godfeer/GoBooks/commands"
"gitee.com/Godfeer/GoBooks/commands/daemon"
_ "gitee.com/Godfeer/GoBooks/routers"
_ "github.com/go-sql-driver/mysql"
"github.com/kardianos/service"
"os"
)
func main() {
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)
}
_ = s.Run()
}
Go
1
https://gitee.com/Godfeer/GoBooks.git
git@gitee.com:Godfeer/GoBooks.git
Godfeer
GoBooks
GoBooks
master

搜索帮助