当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
109 Star 473 Fork 186

Minho / mindoc
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 871 Bytes
一键复制 编辑 原始数据 按行查看 历史
Minho 提交于 2019-05-22 15:11 . feat:增加启动异常处理
package main
import (
"fmt"
"log"
"os"
_ "github.com/astaxie/beego/session/memcache"
_ "github.com/astaxie/beego/session/mysql"
_ "github.com/astaxie/beego/session/redis"
"github.com/kardianos/service"
"github.com/lifei6671/mindoc/commands"
"github.com/lifei6671/mindoc/commands/daemon"
_ "github.com/lifei6671/mindoc/routers"
_ "github.com/mattn/go-sqlite3"
)
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)
}
if err := s.Run(); err != nil {
log.Fatal("启动程序失败 ->", err)
}
}
Go
1
https://gitee.com/longfei6671/godoc.git
git@gitee.com:longfei6671/godoc.git
longfei6671
godoc
mindoc
master

搜索帮助