V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
582033
V2EX  ›  问与答

crontab 每分钟的写法

  •  
  •   582033 · 2013-10-23 18:28:23 +08:00 · 4890 次点击
    这是一个创建于 3843 天前的主题,其中的信息可能已经有所发展或是发生改变。
    难道不是 */1 * * * * 么
    7 条回复    1970-01-01 08:00:00 +08:00
    Livid
        1
    Livid  
    MOD
       2013-10-23 18:29:10 +08:00 via iPhone
    * * * * * command
    582033
        2
    582033  
    OP
       2013-10-23 18:42:48 +08:00
    原来是因为crontab无法直接执行bashrc中的环境变量...
    sophy
        3
    sophy  
       2013-10-23 18:55:57 +08:00 via Android
    @582033 command要写绝对路径
    kfll
        4
    kfll  
       2013-10-23 20:12:23 +08:00 via iPhone
    man 5 crontab
    pubby
        5
    pubby  
       2013-10-23 20:29:25 +08:00
    写法没错的

    个人碰到过crontab唯一坑的地方是
    day of month 和 day of week都指定的话,是任意一个满足就会执行,而不是两个都满足才执行。

    Note: The day of a command's execution can be specified by two fields —
    day of month, and day of week. If both fields are restricted (ie, are
    not *), the command will be run when either field matches the current
    time. For example, ``30 4 1,15 * 5'' would cause a command to be run at
    4:30 am on the 1st and 15th of each month, plus every Friday.
    wzxjohn
        6
    wzxjohn  
       2013-10-23 22:22:26 +08:00
    */1 * * * *

    * * * * *
    均可
    awanabe
        7
    awanabe  
       2013-10-24 17:53:06 +08:00
    楼主运行crontab的时候最好把log输出到一个文件中....用于调试和记录--
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2210 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:55 · PVG 17:55 · LAX 02:55 · JFK 05:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.