2017-04-28 08:09:07 +00:00
|
|
|
|
[![Build Status](https://travis-ci.org/ouqiang/gocron.png)](https://travis-ci.org/ouqiang/gocron)
|
2017-05-26 13:59:01 +00:00
|
|
|
|
# gocron - 定时任务管理系统
|
2017-04-05 12:06:51 +00:00
|
|
|
|
|
2017-05-04 08:50:41 +00:00
|
|
|
|
# 项目简介
|
2017-05-04 10:05:25 +00:00
|
|
|
|
使用Go语言开发的定时任务集中调度和管理系统, 用于替代Linux-crontab [查看文档](https://github.com/ouqiang/gocron/wiki)
|
2017-05-04 08:50:41 +00:00
|
|
|
|
|
2017-04-28 08:06:06 +00:00
|
|
|
|
## 功能特性
|
2017-05-26 14:07:58 +00:00
|
|
|
|
* Web界面管理定时任务, 支持动态添加、删除、编辑任务
|
2017-05-09 05:42:49 +00:00
|
|
|
|
* crontab时间表达式,精确到秒
|
2017-04-28 08:06:06 +00:00
|
|
|
|
* 任务执行失败重试设置
|
|
|
|
|
* 任务超时设置
|
2017-05-14 14:09:36 +00:00
|
|
|
|
* 延时任务
|
2017-06-08 10:04:55 +00:00
|
|
|
|
* 任务依赖
|
2017-05-28 15:13:22 +00:00
|
|
|
|
* 任务类型
|
|
|
|
|
* shell任务
|
2017-06-02 06:11:05 +00:00
|
|
|
|
> 在远程服务器上执行shell命令
|
2017-05-28 15:13:22 +00:00
|
|
|
|
* HTTP任务
|
|
|
|
|
> 访问指定的URL地址
|
2017-04-28 08:06:06 +00:00
|
|
|
|
* 查看任务执行日志
|
|
|
|
|
* 任务执行结果通知, 支持邮件、Slack
|
2017-04-30 23:12:39 +00:00
|
|
|
|
|
|
|
|
|
### 截图
|
2017-06-02 06:11:05 +00:00
|
|
|
|
![流程图](https://raw.githubusercontent.com/ouqiang/gocron/master/scheduler.png)
|
2017-05-02 13:09:48 +00:00
|
|
|
|
![任务](https://raw.githubusercontent.com/ouqiang/gocron/master/screenshot_task.png)
|
|
|
|
|
![Slack](https://raw.githubusercontent.com/ouqiang/gocron/master/screenshot_slack.png)
|
2017-04-28 08:06:06 +00:00
|
|
|
|
|
|
|
|
|
### 支持平台
|
2017-05-09 05:42:49 +00:00
|
|
|
|
> Windows、Linux、Mac OS
|
2017-04-28 08:06:06 +00:00
|
|
|
|
|
|
|
|
|
### 环境要求
|
|
|
|
|
> MySQL
|
|
|
|
|
|
|
|
|
|
|
2017-05-10 03:59:47 +00:00
|
|
|
|
## 下载
|
2017-05-26 13:59:01 +00:00
|
|
|
|
* 调度器(管理后台)
|
|
|
|
|
* [Linux-64位](http://opns468ov.bkt.clouddn.com/gocron/gocron-linux-amd64.tar.gz)
|
|
|
|
|
* [Mac OS-64位](http://opns468ov.bkt.clouddn.com/gocron/gocron-darwin-amd64.tar.gz)
|
|
|
|
|
* [Windows-64位](http://opns468ov.bkt.clouddn.com/gocron/gocron-windows-amd64.zip)
|
2017-05-28 15:13:22 +00:00
|
|
|
|
* 任务执行器(安装在远程主机上, 执行shell命令需安装)
|
2017-05-26 13:59:01 +00:00
|
|
|
|
* [Linux-64位](http://opns468ov.bkt.clouddn.com/gocron/gocron-node-linux-amd64.tar.gz)
|
|
|
|
|
* [Mac OS-64位](http://opns468ov.bkt.clouddn.com/gocron/gocron-node-darwin-amd64.tar.gz)
|
|
|
|
|
* [Windows-64位](http://opns468ov.bkt.clouddn.com/gocron/gocron-node-windows-amd64.zip)
|
|
|
|
|
|
2017-05-10 03:59:47 +00:00
|
|
|
|
|
2017-04-28 08:06:06 +00:00
|
|
|
|
## 安装
|
2017-05-10 03:59:47 +00:00
|
|
|
|
|
2017-04-28 08:06:06 +00:00
|
|
|
|
### 二进制安装
|
2017-05-10 03:59:47 +00:00
|
|
|
|
1. 解压压缩包
|
|
|
|
|
2. `cd 解压目录`
|
2017-05-26 13:59:01 +00:00
|
|
|
|
3. 启动
|
|
|
|
|
* 调度器启动
|
|
|
|
|
* Windows: `gocron.exe web`
|
|
|
|
|
* Linux、Mac OS: `./gocron web`
|
|
|
|
|
* 任务执行器启动
|
2017-05-27 05:33:20 +00:00
|
|
|
|
* Windows: `gocron-node.exe ip:port (默认0.0.0.0:5921)`
|
|
|
|
|
* Linux、Mac OS: `./gocron-node ip:port (默认0.0.0.0:5921)`
|
2017-05-10 03:59:47 +00:00
|
|
|
|
4. 浏览器访问 http://localhost:5920
|
2017-04-28 08:06:06 +00:00
|
|
|
|
### 源码安装
|
2017-05-05 09:34:10 +00:00
|
|
|
|
1. `go`语言版本1.7+
|
2017-05-10 08:09:10 +00:00
|
|
|
|
2. `go get -d github.com/ouqiang/gocron`
|
2017-05-26 13:59:01 +00:00
|
|
|
|
3. 编译
|
2017-05-27 05:33:20 +00:00
|
|
|
|
* 调度器 `go build -tags gocron -o gocron`
|
|
|
|
|
* 任务执行器 `go build -tags node -o gocron-node`
|
2017-05-02 13:49:38 +00:00
|
|
|
|
4. 启动、访问方式同上
|
2017-04-28 08:06:06 +00:00
|
|
|
|
|
2017-05-20 08:26:57 +00:00
|
|
|
|
### 命令
|
2017-04-28 08:06:06 +00:00
|
|
|
|
|
2017-05-20 08:26:57 +00:00
|
|
|
|
* gocron web
|
2017-06-08 10:04:55 +00:00
|
|
|
|
* --host 默认0.0.0.0
|
2017-05-20 08:26:57 +00:00
|
|
|
|
* -p 端口, 指定端口, 默认5920
|
|
|
|
|
* -e 指定运行环境, dev|test|prod, dev模式下可查看更多日志信息, 默认prod
|
|
|
|
|
* -d 后台运行
|
|
|
|
|
* -h 查看帮助
|
|
|
|
|
* gocron serv
|
|
|
|
|
* -s stop|status stop:停止gocron status:查看运行状态
|
2017-05-26 13:59:01 +00:00
|
|
|
|
* gocron-node ip:port, 默认0.0.0.0:5921
|
2017-05-07 03:38:03 +00:00
|
|
|
|
|
2017-05-09 09:34:28 +00:00
|
|
|
|
## 程序使用的组件
|
|
|
|
|
* web框架 [Macaron](http://go-macaron.com/)
|
2017-05-26 13:59:01 +00:00
|
|
|
|
* 定时任务调度 [Cron](https://github.com/robfig/cron)
|
2017-05-09 09:34:28 +00:00
|
|
|
|
* ORM [Xorm](https://github.com/go-xorm/xorm)
|
|
|
|
|
* UI框架 [Semantic UI](https://semantic-ui.com/)
|
2017-05-26 13:59:01 +00:00
|
|
|
|
* 依赖管理(所有依赖包放入vendor目录) [Govendor](https://github.com/kardianos/govendor)
|
2017-05-28 15:13:22 +00:00
|
|
|
|
* RPC框架 [gRPC](https://github.com/grpc/grpc)
|
2017-05-09 09:34:28 +00:00
|
|
|
|
|
2017-05-26 10:09:07 +00:00
|
|
|
|
## 反馈
|
|
|
|
|
提交[issue](https://github.com/ouqiang/gocron/issues/new)
|