All Projects → hezhizheng → go-crontab

hezhizheng / go-crontab

Licence: MIT License
windows 版 crontab | 基于 golang 的 crontab 定时任务管理器 (替代windows定时任务的一种方案)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-crontab

xiaoniu cron
基于APScheduler二次开发,支持集群,可视化,API动态调用等等。BUG及时通知到微信,网页等等。
Stars: ✭ 53 (+194.44%)
Mutual labels:  crontab
commit-bot
Automatically generates GitHub activity
Stars: ✭ 65 (+261.11%)
Mutual labels:  crontab
LexikCronFileGeneratorBundle
This symfony bundle provides service for generate cron file
Stars: ✭ 20 (+11.11%)
Mutual labels:  crontab
watchman
📆 更夫(watchman)是一款可视化的定时任务配置 Web 工具,麻麻不用担心我漏掉任何更新啦!
Stars: ✭ 40 (+122.22%)
Mutual labels:  crontab
Automation-using-Shell-Scripts
Development Automation using Shell Scripting.
Stars: ✭ 41 (+127.78%)
Mutual labels:  crontab
croncal
Utility to convert a crontab file to a list of actual events within a date range.
Stars: ✭ 37 (+105.56%)
Mutual labels:  crontab
serverless-local-schedule
⚡️🗺️⏰ Schedule AWS CloudWatch Event based invocations in local time(with DST support!)
Stars: ✭ 68 (+277.78%)
Mutual labels:  crontab
celery-task-tigger
A controllable timing task widgets with Celery
Stars: ✭ 57 (+216.67%)
Mutual labels:  crontab
crontab
cron expression parser and executor for dotnet core.
Stars: ✭ 13 (-27.78%)
Mutual labels:  crontab
crontask
Use to call scripts or URLs from a crontab file, with optional logging and webhook upon success/failure
Stars: ✭ 19 (+5.56%)
Mutual labels:  crontab
crontab
在弹层界面中组合成crontab表达式,然后实时解析最近5条满足条件的时间(结果),整体可当做VUE组件使用,也可将解析方法单独拎出来。
Stars: ✭ 56 (+211.11%)
Mutual labels:  crontab
corona-kakao-bot
🤖 카카오톡 코로나 알리미
Stars: ✭ 17 (-5.56%)
Mutual labels:  crontab
qinglong
支持python3、javaScript、shell、typescript 的定时任务管理面板(A timed task management panel that supports typescript, javaScript, python3, and shell)
Stars: ✭ 6,944 (+38477.78%)
Mutual labels:  crontab
async cron
crontab for python,with asyncio
Stars: ✭ 23 (+27.78%)
Mutual labels:  crontab
awesome-web-online-tools
Many many useful Web Online Tools For Web Developers&Programmers
Stars: ✭ 13 (-27.78%)
Mutual labels:  crontab
node-cron-expression
Declarative functional cron expression builder
Stars: ✭ 17 (-5.56%)
Mutual labels:  crontab
gronx
Lightweight, fast and dependency-free Cron expression parser (due checker), task scheduler and/or daemon for Golang (tested on v1.13 and above) and standalone usage
Stars: ✭ 206 (+1044.44%)
Mutual labels:  crontab
Agile-Server
A simple, fast, complete Node.js server solution, based on KOA. 简单快速的 、性能强劲的、功能齐全的 node 服务器解决方案合集,基于 KOA。
Stars: ✭ 24 (+33.33%)
Mutual labels:  crontab
asparagus
An easy to use task scheduler for distributed systems
Stars: ✭ 14 (-22.22%)
Mutual labels:  crontab
golearn
🔥 Golang basics and actual-combat (including: crawler, distributed-systems, data-analysis, redis, etcd, raft, crontab-task)
Stars: ✭ 36 (+100%)
Mutual labels:  crontab

Go-Crontab

基于 golang 的 crontab 定时任务管理器,解决在win环境开发下没有好用的定时任务管理器的囧境。

features

  • 支持分钟跟秒级
  • 自动识别当前系统 unix系统内部调用 bash -c 命令,windows 系统内部调用 cmd /c
  • 支持指定 bash 或 cmd 命令
  • 自动生成log日志文件记录
  • 理论上跨平台支持 Windows 、Linux、MacOs
  • 自用test(windows下的确没啥好用的定时任务管理器。。。还不如自己搞一个)

使用

自定义json配置文件

# 参数说明
{
  # 支持定义多个定时任务,直接在 crontab_cmd 追加对象即可
  "app": {
    "model": "s", # 默认 s 秒级 如需使用分钟级改为 m
    "exec_mode":"bash", # 默认空字符串,程序会根据当前操作系统自动区分执行bash还是cmd命令,支持指定命令执行,可选参数 bash/cmd
    "crontab_cmd": [
      {
        "crontab": "0/1 * * * * ?", #crontab 表达式
        "cmd": "go version" # 要执行的命令 
      }
    ]
  }
}

# windows 实现 laravel 的任务调度 schedule:run (只支持分钟级别,不能定义秒级的!!!)
# app.model可以定义为s 但是对应的crontab表达式必须为每分钟运行!可参考 Java(Quartz) 表达式书写
# 或直接定义app.model 为 m ,则crontab表达式为 "* * * * *"
# 命令表达式需要与对应环境匹配
# 如 bash 环境下 的命令为:cd /e/www/project/dexter/laravel-test-demo && php artisan schedule:run 
# 那么 cmd 对应的命令就为:e: && cd E:\www\project\dexter\laravel-test-demo && php artisan schedule:run


{
  "app": {
    "model": "s",
    "exec_mode":"bash",
    "crontab_cmd": [
      {
        "crontab": "0 0/1 * * * ?",
        "cmd": "go version"
      },
      {
        "crontab": "0 0/1 * * * ?",
        "cmd": "cd /e/www/project/dexter/laravel-test-demo && php artisan schedule:run"
      }
    ]
  }
}


执行路径名中存在空格的解决方案

编译

(windows提供编译好的文件下载 releases )

go build -ldflags "-s -w" -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}"

运行

  • 保证编译的文件与 config.json 在同级目录

  • 执行 ./go-crontab.exe (不要关闭终端) free-pic

  • 执行过程会自动生成log文件(保存一周,会定期清理)

{"level":"info","msg":"执行命令: go version 输出: go version go1.15.2 windows/386\n 执行耗时: 0.10 s","time":"2021-07-24 10:39:00"}
{"level":"info","msg":"执行命令: php -f q.php 输出: sleep done 执行耗时: 5.15 s","time":"2021-07-24 10:39:05"}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].