diff --git a/README.md b/README.md index b754891..8d180b6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ -# cron-scheduler - 定时任务调度、管理 +# gocron - 定时任务web管理平台 -[](https://travis-ci.org/ouqiang/cron-scheduler) \ No newline at end of file +[](https://travis-ci.org/ouqiang/cron-scheduler) + +## 安装, 解压后执行 +```shell + ./gocron server +``` +可选参数 ++ -p 端口, 指定端口 ++ -d 后台运行 (不支持windows) ++ -h 查看帮 diff --git a/models/task.go b/models/task.go index 7c0e234..5ed54bd 100644 --- a/models/task.go +++ b/models/task.go @@ -19,7 +19,7 @@ type Task struct { Id int `xorm:"int pk autoincr"` Name string `xorm:"varchar(64) notnull"` // 任务名称 Spec string `xorm:"varchar(64) notnull"` // crontab - Protocol TaskProtocol `xorm:"tinyint notnull"` // 协议 1:http 2:ssh-command 3: 本地命令 + Protocol TaskProtocol `xorm:"tinyint notnull"` // 协议 1:http 2:ssh-command 3: 系统命令 Command string `xorm:"varchar(512) notnull"` // URL地址或shell命令 Timeout int `xorm:"mediumint notnull default 0"` // 任务执行超时时间(单位秒),0不限制 RetryTimes int8 `xorm:"tinyint notnull default 0"` // 重试次数 diff --git a/models/task_log.go b/models/task_log.go index d517168..c0af3e9 100644 --- a/models/task_log.go +++ b/models/task_log.go @@ -14,7 +14,7 @@ type TaskLog struct { TaskId int `xorm:"int notnull index default 0"` // 任务id Name string `xorm:"varchar(64) notnull"` // 任务名称 Spec string `xorm:"varchar(64) notnull"` // crontab - Protocol TaskProtocol `xorm:"tinyint notnull"` // 协议 1:http 2:ssh-command + Protocol TaskProtocol `xorm:"tinyint notnull"` // 协议 1:http 2:ssh-command 3:系统命令 Command string `xorm:"varchar(512) notnull"` // URL地址或shell命令 Timeout int `xorm:"mediumint notnull default 0"` // 任务执行超时时间(单位秒),0不限制 RetryTimes int8 `xorm:"tinyint notnull default 0"` // 任务重试次数 diff --git a/routers/task/task.go b/routers/task/task.go index 84ad603..b943a4d 100644 --- a/routers/task/task.go +++ b/routers/task/task.go @@ -247,7 +247,7 @@ func parseQueryParams(ctx *macaron.Context) (models.CommonMap) { func setHostsToTemplate(ctx *macaron.Context) { hostModel := new(models.Host) hosts, err := hostModel.List(models.CommonMap{}) - if err != nil || len(hosts) == 0 { + if err != nil { logger.Error(err) } ctx.Data["Hosts"] = hosts diff --git a/templates/install/create.html b/templates/install/create.html index 1e7e4e0..2858aef 100644 --- a/templates/install/create.html +++ b/templates/install/create.html @@ -14,6 +14,10 @@