mirror of https://github.com/shunfei/cronsun
Update README
parent
6e76bbe8b4
commit
acd2f593ec
|
@ -1,4 +1,5 @@
|
||||||
conf/files/*.json
|
conf/files/*.json
|
||||||
|
dist
|
||||||
.tags
|
.tags
|
||||||
.tags_sorted_by_file
|
.tags_sorted_by_file
|
||||||
bin/*/*server
|
bin/*/*server
|
||||||
|
|
62
README.md
62
README.md
|
@ -1 +1,61 @@
|
||||||
# cronsun
|
# cronsun
|
||||||
|
|
||||||
|
`cronsun` 是一个分布式任务系统,单个结点和 `*nix` 机器上的 `crontab` 近似。支持界面管理机器上的任务,支持任务失败邮件提醒,安装简单,使用方便,是替换 `crontab` 一个不错的选择。
|
||||||
|
|
||||||
|
## 架构
|
||||||
|
|
||||||
|
```
|
||||||
|
[web]
|
||||||
|
|
|
||||||
|
--------------------------
|
||||||
|
(add/del/update/exec jobs)| |(query job exec result)
|
||||||
|
[etcd] [mongodb]
|
||||||
|
| ^
|
||||||
|
-------------------- |
|
||||||
|
| | | |
|
||||||
|
[node.1] [node.2] [node.n] |
|
||||||
|
(job exec fail)| | | |
|
||||||
|
[send mail]<-----------------------------------------(job exec result)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
### Building the source
|
||||||
|
|
||||||
|
```
|
||||||
|
cd $GOPATH/src
|
||||||
|
git clone https://github.com/shunfei/cronsun.git
|
||||||
|
cd cronsun
|
||||||
|
sh ./build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
执行文件和配置文件在 `dist` 文件夹
|
||||||
|
|
||||||
|
### Run
|
||||||
|
|
||||||
|
1. 安装 [MongoDB](http://docs.mongodb.org/manual/installation/)
|
||||||
|
2. 安装 [etcd](https://github.com/coreos/etcd)
|
||||||
|
3. 修改 `conf` 相关的配置
|
||||||
|
4. 在任务结点启动 `./node -conf conf/base.json`,在管理结点启动 `./web -conf conf/base.json`
|
||||||
|
5. 访问管理界面 `http://127.0.0.1:7079/ui/`
|
||||||
|
|
||||||
|
## Screenshot
|
||||||
|
|
||||||
|
**Brief**:
|
||||||
|
|
||||||
|
![](doc/img/brief.png)
|
||||||
|
|
||||||
|
**Exec result**:
|
||||||
|
|
||||||
|
![](doc/img/log.png)
|
||||||
|
|
||||||
|
**Job**:
|
||||||
|
|
||||||
|
![](doc/img/job.png)
|
||||||
|
|
||||||
|
![](doc/img/new_job.png)
|
||||||
|
|
||||||
|
**Node**:
|
||||||
|
|
||||||
|
![](doc/img/node.png)
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function check_code() {
|
||||||
|
EXCODE=$?
|
||||||
|
if [ "$EXCODE" != "0" ]; then
|
||||||
|
echo "build fail."
|
||||||
|
exit $EXCODE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
out="dist"
|
||||||
|
echo "build file to ./$out"
|
||||||
|
|
||||||
|
mkdir -p "$out/conf"
|
||||||
|
|
||||||
|
go build -o ./$out/node ./bin/node/server.go
|
||||||
|
check_code
|
||||||
|
go build -o ./$out/web ./bin/web/server.go
|
||||||
|
check_code
|
||||||
|
|
||||||
|
sources=`find ./conf/files -name "*.json.sample"`
|
||||||
|
check_code
|
||||||
|
for source in $sources;do
|
||||||
|
yes | echo $source|sed "s/.*\/\(\w*\.json\).*/cp -f & .\/$out\/conf\/\1/"|bash
|
||||||
|
check_code
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "build success."
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"Hosts": [
|
"Hosts": [
|
||||||
"192.168.11.16:3000"
|
"127.0.0.1:27017"
|
||||||
],
|
],
|
||||||
"Database": "cronsun",
|
"Database": "cronsun",
|
||||||
"#Timeout": "connect timeout duration/second",
|
"#Timeout": "connect timeout duration/second",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"Enable": true,
|
"Enable": false,
|
||||||
"To": ["na@nb.com"],
|
"To": ["na@nb.com"],
|
||||||
"#HttpAPI": "如有此字段,则按 http api 方式发送",
|
"#HttpAPI": "如有此字段,则按 http api 方式发送",
|
||||||
"#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒",
|
"#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒",
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
After Width: | Height: | Size: 200 KiB |
Binary file not shown.
After Width: | Height: | Size: 124 KiB |
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
Loading…
Reference in New Issue