V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
geew
V2EX  ›  Linux

有关 crontab 一个表达式的问题

  •  
  •   geew · Mar 2, 2020 · 3340 views
    This topic created in 2247 days ago, the information mentioned may be changed or developed.
    ➜ ~ crontab -l
    2/1 * * * * echo "hello" > /tmp/t.log # 表示从 2 分钟开始 每分钟执行.

    这个表达式 Mac 上添加是没问题的 但是在 centos 上 没法添加. 提示
    crontab: installing new crontab
    "/tmp/crontab.cDUD1Q":1: bad minute
    errors in crontab file, can't install. # 格式错误

    这个表达式应该是合法的才对啊 有人知道怎么解决吗? 是 crontab 的版本太低了么

    系统版本: CentOS Linux release 7.5.1804 (Core)
    crontab 版本:
    rpm -qa|grep -i cronie
    cronie-anacron-1.4.11-19.el7.x86_64
    cronie-1.4.11-19.el7.x86_64
    6 replies    2020-03-03 13:49:28 +08:00
    1KN6sAqR0a57no6s
        1
    1KN6sAqR0a57no6s  
       Mar 2, 2020
    https://crontab.guru/#2/1_*_*_*_*
    atx
        2
    atx  
       Mar 2, 2020   ❤️ 1
    得这样写: 2-59/1 * * * *
    geew
        3
    geew  
    OP
       Mar 2, 2020
    @YuxiangLuo 这个表达式是没问题的 问题是 centos 上没法设置
    1KN6sAqR0a57no6s
        4
    1KN6sAqR0a57no6s  
       Mar 2, 2020
    @geew 你看网页有提示啊 Non standard! May not work with every cron. 我试了在 Ubuntu18.04 也是一样的错误。
    geew
        5
    geew  
    OP
       Mar 2, 2020
    @YuxiangLuo 哈哈 太小的一行字 没注意 2 楼的是可以的
    chjtwo
        6
    chjtwo  
       Mar 3, 2020
    每分钟都执行就直接 2-59 * * * *
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5977 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 02:00 · PVG 10:00 · LAX 19:00 · JFK 22:00
    ♥ Do have faith in what you're doing.