Coder Social home page Coder Social logo

hezhizheng / go-crontab Goto Github PK

View Code? Open in Web Editor NEW
45.0 45.0 2.0 64 KB

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

License: MIT License

Go 100.00%
crontab go go-crontab golang golang-crontab windows windows-crontab

go-crontab's Introduction

👨🏼‍💻 Dexter Ho(ZhiZheng He)

👋 Hi, I'm Dexter Ho(ZhiZheng He),a backend developer from China.

DexterHo's github stats

About

  • Learning : Full-Stack Development ⚡ | Open-Source 🔥
  • Languages : PHP, Go, JavaScript
  • Hobbies : Travel: 🧳 & Music: 🎵 Cantopop & language: 📢 Cantonese
  • Contact me : Twitter Instagram Weibo

Languages and Tools

I love to make friends. so if you want to say hi, I'll be happy to meet you more! 😊

go-crontab's People

Contributors

hezhizheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

sscrew xiaodela

go-crontab's Issues

设置git命令时 如果git仓库中有中文名文件 日志中出现乱码

配置文件如下

{
  "comments": {
    "comment0": "app.model 默认 s 秒级 如需使用分钟级改为 m ",
    "comment00": "app.exec_mode 默认空字符串,程序会根据当前操作系统自动区分执行bash还是cmd命令,支持指定命令执行,可选参数 bash/cmd ",
    "comment_0": "app.crontab_cmd 为自定义的 crontab 表达式 与 要执行的命令 数组、支持多个,配置可参考一下配置",
    "comment1": "// 这些是注释,不用理会 Java(Quartz)  0 0/1 * * * ?(每分钟)  0/1 * * * * ?(每秒)"
  },
  "app": {
    "model": "m",
    "exec_mode":"",
    "crontab_cmd": [
      {
        "crontab": "* * * * * ",
        "cmd": "go version"
      },
      {
        "crontab": "* * * * *",
        "cmd": "C: && cd C:\\Users\\Administrator\\.config\\clash && git add . && git commit -m '自动提交' && git push clash master "
      }
    ]
  }
}

日志文件如下:

{"level":"info","msg":"执行命令: C: && cd C:\\Users\\Administrator\\.config\\clash && git add . && git commit -m '自动提交' && git push clash master  输出: warning: LF will be replaced by CRLF in ProjecgSi鏈哄満鍦板潃浠ュ強璐︽埛瀵嗙爜.txt.\nThe file will have its original line endings in your working directory\n[master f43584d] '鑷�姩鎻愪氦'\n 1 file changed, 1 insertion(+)\nTo https://github.com/129duckflew/clash-config.git\n   59e27cb..f43584d  master -> master\n 执行耗时: 3.13 s","time":"2022-02-08 01:17:03"}
{"level":"error","msg":"exit status 1","time":"2022-02-08 01:18:00"}

执行路径名中存在空格如何处理,单引号转义无效

例如这样的路径 "node d:\'4 Node'\4\test.js"

.--------.---------------.------------------------------.----------.
| 任务ID | 表达式 | 执行命令 | 错误信息 |
+--------+---------------+------------------------------+----------+
| 1 | 0/5 * * * * ? | node d:'4 Node'\4\test.js | nil |
'--------'---------------'------------------------------'----------'
输入任意键退出

{"level":"info","msg":"执行命令: node d:\'4 Node'\4\test.js 输出: node:internal/modules/cjs/loader:930\r\n throw err;\r\n

实际识别成了d:\4的路径,对空格没有很好地处理

试过
"node d:\'4 Node'\4\test.js"
"node d:\4 Node\4\test.js"
"node d:\\"4 Node"\\4\\test.js"
路径转义始终失败

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.