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

crontab 不执行的问题

  •  
  •   qsnow6 · 2018-07-09 14:41:15 +08:00 · 1240 次点击
    这是一个创建于 2348 天前的主题,其中的信息可能已经有所发展或是发生改变。

    给 crontab 添加了任务,但是不知道为什么不执行,检查了下,看了下 log 文件,确实没执行,不知道哪里出了问题。

    [root@localhost /]# crontab -l
    1 * * * * root date > /tmp/date.log
    
    [root@localhost tmp]# date
    Mon Jul  9 02:39:29 EDT 2018
    
    [root@localhost tmp]# ls
    crontab.cIbRuo
    

    log

    
    Jul  9 02:29:31 localhost crontab[21567]: (root) END EDIT (root)
    Jul  9 02:29:46 localhost crontab[21600]: (root) LIST (root)
    Jul  9 02:29:47 localhost crontab[21602]: (root) LIST (root)
    Jul  9 02:30:02 localhost crond[21551]: (CRON) INFO (running with inotify support)
    Jul  9 02:30:12 localhost crontab[21648]: (root) BEGIN EDIT (root)
    Jul  9 02:30:17 localhost crontab[21648]: (root) END EDIT (root)
    Jul  9 02:30:29 localhost crond[21712]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 14% if used.)
    Jul  9 02:30:30 localhost crond[21712]: (CRON) bad username (/etc/crontab)
    Jul  9 02:30:33 localhost crond[21712]: (CRON) INFO (running with inotify support)
    Jul  9 02:30:33 localhost crond[21712]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
    Jul  9 02:30:35 localhost crontab[21714]: (root) LIST (root)
    Jul  9 02:30:36 localhost crontab[21716]: (root) LIST (root)
    Jul  9 02:30:38 localhost crontab[21718]: (root) LIST (root)
    Jul  9 02:31:07 localhost crontab[21782]: (root) BEGIN EDIT (root)
    Jul  9 02:31:13 localhost crontab[21782]: (root) REPLACE (root)
    Jul  9 02:31:13 localhost crontab[21782]: (root) END EDIT (root)
    Jul  9 02:31:28 localhost crond[21815]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 72% if used.)
    Jul  9 02:31:29 localhost crond[21815]: (CRON) bad username (/etc/crontab)
    Jul  9 02:31:31 localhost crond[21815]: (CRON) INFO (running with inotify support)
    Jul  9 02:31:31 localhost crond[21815]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
    Jul  9 02:34:01 localhost crond[21815]: (localhost.localdomain.tmp.XXXXMdDmOK) ORPHAN (no passwd entry)
    Jul  9 02:38:24 localhost crontab[21929]: (root) LIST (root)
    Jul  9 02:38:28 localhost crontab[21931]: (root) LIST (root)
    Jul  9 02:38:30 localhost crontab[21933]: (root) BEGIN EDIT (root)
    Jul  9 02:38:41 localhost crontab[21933]: (root) REPLACE (root)
    Jul  9 02:38:41 localhost crontab[21933]: (root) END EDIT (root)
    Jul  9 02:39:01 localhost crond[21815]: (root) RELOAD (/var/spool/cron/root)
    
    
    qsnow6
        1
    qsnow6  
    OP
       2018-07-09 14:53:22 +08:00
    解决了,本来打算是每分钟执行一次的,应该写成*/1 * * * *
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1491 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 16:53 · PVG 00:53 · LAX 08:53 · JFK 11:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.