Browse Source

Update README

pull/1/head
miraclesu 8 years ago
parent
commit
acd2f593ec
  1. 1
      .gitignore
  2. 62
      README.md
  3. 28
      build.sh
  4. 2
      conf/files/db.json.sample
  5. 2
      conf/files/mail.json.sample
  6. BIN
      doc/img/brief.png
  7. BIN
      doc/img/job.png
  8. BIN
      doc/img/log.png
  9. BIN
      doc/img/new_job.png
  10. BIN
      doc/img/node.png

1
.gitignore vendored

@ -1,4 +1,5 @@
conf/files/*.json
dist
.tags
.tags_sorted_by_file
bin/*/*server

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)

28
build.sh

@ -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."

2
conf/files/db.json.sample

@ -1,6 +1,6 @@
{
"Hosts": [
"192.168.11.16:3000"
"127.0.0.1:27017"
],
"Database": "cronsun",
"#Timeout": "connect timeout duration/second",

2
conf/files/mail.json.sample

@ -1,5 +1,5 @@
{
"Enable": true,
"Enable": false,
"To": ["na@nb.com"],
"#HttpAPI": "如有此字段,则按 http api 方式发送",
"#Keepalive": "如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒",

BIN
doc/img/brief.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
doc/img/job.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

BIN
doc/img/log.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
doc/img/new_job.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
doc/img/node.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Loading…
Cancel
Save