mirror of https://github.com/ouqiang/gocron
项目包名改为 github.com/ouqiang
parent
e8351141c0
commit
3a3ae7e024
|
@ -6,7 +6,9 @@ import (
|
||||||
"github.com/go-macaron/gzip"
|
"github.com/go-macaron/gzip"
|
||||||
"github.com/go-macaron/session"
|
"github.com/go-macaron/session"
|
||||||
"github.com/go-macaron/csrf"
|
"github.com/go-macaron/csrf"
|
||||||
"scheduler/modules/app"
|
"github.com/ouqiang/cron-scheduler/modules/app"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// web服务器默认端口
|
// web服务器默认端口
|
||||||
|
@ -43,6 +45,8 @@ func run(ctx *cli.Context) {
|
||||||
|
|
||||||
// 定时任务调度
|
// 定时任务调度
|
||||||
func runScheduler() {
|
func runScheduler() {
|
||||||
|
fmt.Println("hello world")
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 路由注册
|
// 路由注册
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*--------------------------------------------------------
|
||||||
|
定时任务调度
|
||||||
|
兼容Linux crontab时间格式语法,最小粒度可精确到每秒
|
||||||
|
支持通过HTTP、SSH协议触发任务执行
|
||||||
|
--------------------------------------------------------*/
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/ouqiang/cron-scheduler/cmd"
|
||||||
|
)
|
||||||
|
|
||||||
|
const AppVersion = "0.0.1"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := cli.NewApp()
|
||||||
|
app.Name = "scheduler"
|
||||||
|
app.Usage = "schedule cron service"
|
||||||
|
app.Version = AppVersion
|
||||||
|
app.Commands = []cli.Command{
|
||||||
|
cmd.CmdWeb,
|
||||||
|
}
|
||||||
|
app.Flags = append(app.Flags, []cli.Flag{}...)
|
||||||
|
app.Run(os.Args)
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ package models
|
||||||
import (
|
import (
|
||||||
"github.com/go-xorm/xorm"
|
"github.com/go-xorm/xorm"
|
||||||
"fmt"
|
"fmt"
|
||||||
"scheduler/modules/setting"
|
"github.com/ouqiang/cron-scheduler/modules/setting"
|
||||||
"github.com/go-xorm/core"
|
"github.com/go-xorm/core"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"gopkg.in/macaron.v1"
|
"gopkg.in/macaron.v1"
|
||||||
|
|
|
@ -2,7 +2,7 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
"scheduler/modules/utils"
|
"github.com/ouqiang/cron-scheduler/modules/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const PasswordSaltLength = 6;
|
const PasswordSaltLength = 6;
|
||||||
|
|
|
@ -4,10 +4,10 @@ package ansible
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"scheduler/modules/utils"
|
|
||||||
"errors"
|
"errors"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"github.com/ouqiang/cron-scheduler/modules/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handler map[string]interface{}
|
type Handler map[string]interface{}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package ansible
|
package ansible
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"scheduler/models"
|
"github.com/ouqiang/cron-scheduler/models"
|
||||||
"sync"
|
"sync"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
|
@ -2,11 +2,12 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"scheduler/modules/crontask"
|
|
||||||
"scheduler/models"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"scheduler/modules/utils"
|
|
||||||
"scheduler/modules/ansible"
|
"github.com/ouqiang/cron-scheduler/modules/utils"
|
||||||
|
"github.com/ouqiang/cron-scheduler/modules/ansible"
|
||||||
|
"github.com/ouqiang/cron-scheduler/modules/crontask"
|
||||||
|
"github.com/ouqiang/cron-scheduler/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"scheduler/models"
|
"github.com/ouqiang/cron-scheduler/models"
|
||||||
"scheduler/modules/utils"
|
"github.com/ouqiang/cron-scheduler/modules/utils"
|
||||||
"net/http"
|
"net/http"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
"scheduler/modules/crontask"
|
"github.com/ouqiang/cron-scheduler/modules/crontask"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Task struct {}
|
type Task struct {}
|
||||||
|
|
|
@ -107,5 +107,5 @@
|
||||||
"revisionTime": "2017-02-08T14:18:51Z"
|
"revisionTime": "2017-02-08T14:18:51Z"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rootPath": "scheduler"
|
"rootPath": "cron-scheduler"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue