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

crontab 不执行问题

  •  1
     
  •   wex · 2016-05-20 22:07:42 +08:00 · 2666 次点击
    这是一个创建于 2918 天前的主题,其中的信息可能已经有所发展或是发生改变。
    * * * * * echo 'aaa' >> /home/pi/aa.txt 这样写,每分钟执行,他会执行,但是

    09 22* * * echo 'aaa' >> /home/pi/aa.txt 他就不会执行,这个是为啥啊?哪里出问题了?
    12 条回复    2016-05-20 22:53:38 +08:00
    coolair
        1
    coolair  
       2016-05-20 22:13:25 +08:00
    少了个空格
    wex
        2
    wex  
    OP
       2016-05-20 22:14:18 +08:00
    @coolair 不是空格问题,刚才发帖没注意格式,
    mimzy
        3
    mimzy  
       2016-05-20 22:14:27 +08:00
    09 22 * * *
    wex
        4
    wex  
    OP
       2016-05-20 22:18:43 +08:00
    @mimzy 真的不是空格问题。
    mimzy
        5
    mimzy  
       2016-05-20 22:20:22 +08:00
    去看看 log: 09 22 * * * echo 'aaa' >> /home/pi/aa.txt >> /YOUR/LOG/PATH.log 2>&1 或者 grep CRON /var/log/syslog
    coolair
        6
    coolair  
       2016-05-20 22:20:51 +08:00
    看下日志啊
    mimzy
        7
    mimzy  
       2016-05-20 22:21:24 +08:00
    上边回复错了……忽略我
    wex
        8
    wex  
    OP
       2016-05-20 22:29:13 +08:00
    @coolair
    @mimzy


    May 19 15:26:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 19 16:17:01 raspberrypi CRON[3405]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 17:17:01 raspberrypi CRON[3439]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 18:17:01 raspberrypi CRON[3472]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 19:17:01 raspberrypi CRON[3505]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 20:17:01 raspberrypi CRON[3537]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 21:17:01 raspberrypi CRON[3571]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 22:17:01 raspberrypi CRON[3604]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 19 23:17:01 raspberrypi CRON[3638]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 00:17:01 raspberrypi CRON[3671]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 01:17:01 raspberrypi CRON[3704]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 02:17:01 raspberrypi CRON[3738]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 03:17:01 raspberrypi CRON[3771]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 04:17:01 raspberrypi CRON[3816]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 05:17:01 raspberrypi CRON[3850]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 06:17:01 raspberrypi CRON[3885]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 06:25:01 raspberrypi CRON[3903]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
    May 20 07:17:01 raspberrypi CRON[4051]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 08:17:01 raspberrypi CRON[4086]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 09:17:01 raspberrypi CRON[4119]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 10:17:01 raspberrypi CRON[4156]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 11:17:01 raspberrypi CRON[4268]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 11:20:18 raspberrypi crontab[4420]: (pi) BEGIN EDIT (pi)
    May 20 11:20:39 raspberrypi crontab[4420]: (pi) REPLACE (pi)
    May 20 11:20:39 raspberrypi crontab[4420]: (pi) END EDIT (pi)
    May 20 11:21:02 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 11:26:58 raspberrypi crontab[4437]: (pi) BEGIN EDIT (pi)
    May 20 11:28:14 raspberrypi crontab[4437]: (pi) REPLACE (pi)
    May 20 11:28:14 raspberrypi crontab[4437]: (pi) END EDIT (pi)
    May 20 11:29:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 11:30:31 raspberrypi crontab[4467]: (root) BEGIN EDIT (root)
    May 20 11:31:10 raspberrypi crontab[4467]: (root) REPLACE (root)
    May 20 11:31:10 raspberrypi crontab[4467]: (root) END EDIT (root)
    May 20 11:34:16 raspberrypi crontab[4516]: (root) BEGIN EDIT (root)
    May 20 11:34:27 raspberrypi crontab[4516]: (root) REPLACE (root)
    May 20 11:34:27 raspberrypi crontab[4516]: (root) END EDIT (root)
    May 20 11:35:01 raspberrypi cron[415]: (root) RELOAD (crontabs/root)
    May 20 11:35:34 raspberrypi crontab[4549]: (root) BEGIN EDIT (root)
    May 20 11:36:24 raspberrypi crontab[4549]: (root) REPLACE (root)
    May 20 11:36:24 raspberrypi crontab[4549]: (root) END EDIT (root)
    May 20 11:36:31 raspberrypi crontab[4577]: (root) BEGIN EDIT (root)
    May 20 11:36:39 raspberrypi crontab[4577]: (root) END EDIT (root)
    May 20 11:36:49 raspberrypi crontab[4595]: (root) BEGIN EDIT (root)
    May 20 11:37:01 raspberrypi cron[415]: (root) RELOAD (crontabs/root)
    May 20 11:37:09 raspberrypi crontab[4595]: (root) END EDIT (root)
    May 20 11:37:23 raspberrypi crontab[4614]: (root) BEGIN EDIT (root)
    May 20 11:37:37 raspberrypi crontab[4614]: (root) REPLACE (root)
    May 20 11:37:37 raspberrypi crontab[4614]: (root) END EDIT (root)
    May 20 11:38:01 raspberrypi cron[415]: (root) RELOAD (crontabs/root)
    May 20 11:38:46 raspberrypi crontab[4666]: (root) BEGIN EDIT (root)
    May 20 11:38:59 raspberrypi crontab[4666]: (root) REPLACE (root)
    May 20 11:38:59 raspberrypi crontab[4666]: (root) END EDIT (root)
    May 20 11:39:01 raspberrypi cron[415]: (root) RELOAD (crontabs/root)
    May 20 11:44:23 raspberrypi crontab[4740]: (root) BEGIN EDIT (root)
    May 20 11:44:30 raspberrypi crontab[4740]: (root) REPLACE (root)
    May 20 11:44:30 raspberrypi crontab[4740]: (root) END EDIT (root)
    May 20 11:45:01 raspberrypi cron[415]: (root) RELOAD (crontabs/root)
    May 20 11:45:29 raspberrypi crontab[4778]: (root) BEGIN EDIT (root)
    May 20 11:46:01 raspberrypi crontab[4778]: (root) REPLACE (root)
    May 20 11:46:01 raspberrypi crontab[4778]: (root) END EDIT (root)
    May 20 11:47:01 raspberrypi cron[415]: (root) RELOAD (crontabs/root)
    May 20 11:59:11 raspberrypi crontab[4799]: (root) BEGIN EDIT (root)
    May 20 11:59:16 raspberrypi crontab[4799]: (root) END EDIT (root)
    May 20 11:59:28 raspberrypi crontab[4819]: (root) BEGIN EDIT (root)
    May 20 11:59:35 raspberrypi crontab[4819]: (root) END EDIT (root)
    May 20 12:17:01 raspberrypi CRON[4851]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 13:06:17 raspberrypi crontab[4912]: (pi) BEGIN EDIT (pi)
    May 20 13:06:38 raspberrypi crontab[4912]: (pi) REPLACE (pi)
    May 20 13:06:38 raspberrypi crontab[4912]: (pi) END EDIT (pi)
    May 20 13:07:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:08:05 raspberrypi crontab[4948]: (pi) BEGIN EDIT (pi)
    May 20 13:09:11 raspberrypi crontab[4948]: (pi) REPLACE (pi)
    May 20 13:09:11 raspberrypi crontab[4948]: (pi) END EDIT (pi)
    May 20 13:09:42 raspberrypi crontab[4971]: (pi) BEGIN EDIT (pi)
    May 20 13:10:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:11:23 raspberrypi crontab[4971]: (pi) REPLACE (pi)
    May 20 13:11:23 raspberrypi crontab[4971]: (pi) END EDIT (pi)
    May 20 13:11:33 raspberrypi crontab[5004]: (pi) BEGIN EDIT (pi)
    May 20 13:11:47 raspberrypi crontab[5004]: (pi) REPLACE (pi)
    May 20 13:11:47 raspberrypi crontab[5004]: (pi) END EDIT (pi)
    May 20 13:11:55 raspberrypi crontab[5020]: (pi) BEGIN EDIT (pi)
    May 20 13:12:00 raspberrypi crontab[5020]: (pi) REPLACE (pi)
    May 20 13:12:00 raspberrypi crontab[5020]: (pi) END EDIT (pi)
    May 20 13:12:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:15:00 raspberrypi crontab[5038]: (pi) BEGIN EDIT (pi)
    May 20 13:16:19 raspberrypi crontab[5038]: (pi) REPLACE (pi)
    May 20 13:16:19 raspberrypi crontab[5038]: (pi) END EDIT (pi)
    May 20 13:16:29 raspberrypi crontab[5053]: (pi) BEGIN EDIT (pi)
    May 20 13:16:35 raspberrypi crontab[5053]: (pi) END EDIT (pi)
    May 20 13:17:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:17:01 raspberrypi CRON[5069]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
    May 20 13:17:13 raspberrypi crontab[5095]: (pi) BEGIN EDIT (pi)
    May 20 13:17:29 raspberrypi crontab[5095]: (pi) REPLACE (pi)
    May 20 13:17:29 raspberrypi crontab[5095]: (pi) END EDIT (pi)
    May 20 13:18:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:20:59 raspberrypi crontab[5110]: (pi) BEGIN EDIT (pi)
    May 20 13:21:11 raspberrypi crontab[5110]: (pi) REPLACE (pi)
    May 20 13:21:11 raspberrypi crontab[5110]: (pi) END EDIT (pi)
    May 20 13:22:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:22:43 raspberrypi crontab[5124]: (pi) BEGIN EDIT (pi)
    May 20 13:22:48 raspberrypi crontab[5124]: (pi) END EDIT (pi)
    May 20 13:24:19 raspberrypi crontab[5144]: (pi) BEGIN EDIT (pi)
    May 20 13:25:13 raspberrypi crontab[5144]: (pi) REPLACE (pi)
    May 20 13:25:13 raspberrypi crontab[5144]: (pi) END EDIT (pi)
    May 20 13:25:54 raspberrypi cron[5158]: (CRON) DEATH (can't open or create /var/run/crond.pid: Permission denied)
    May 20 13:26:00 raspberrypi cron[5163]: (CRON) DEATH (can't lock /var/run/crond.pid, otherpid may be 415: Resource temporarily unavailable)
    May 20 13:26:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:26:11 raspberrypi crontab[5170]: (pi) BEGIN EDIT (pi)
    May 20 13:26:34 raspberrypi crontab[5170]: (pi) REPLACE (pi)
    May 20 13:26:34 raspberrypi crontab[5170]: (pi) END EDIT (pi)
    May 20 13:27:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:27:08 raspberrypi crontab[5229]: (pi) BEGIN EDIT (pi)
    May 20 13:27:53 raspberrypi crontab[5229]: (pi) REPLACE (pi)
    May 20 13:27:53 raspberrypi crontab[5229]: (pi) END EDIT (pi)
    May 20 13:27:58 raspberrypi crontab[5242]: (pi) BEGIN EDIT (pi)
    May 20 13:28:01 raspberrypi cron[415]: (pi) RELOAD (crontabs/pi)
    May 20 13:28:1
    Devin
        9
    Devin  
       2016-05-20 22:41:16 +08:00 via iPhone
    注意下系统时间和时区
    coolair
        10
    coolair  
       2016-05-20 22:51:56 +08:00 via Android
    Crontab 分 时 * * *
    date 看你树莓的时间是下午呢
    wex
        11
    wex  
    OP
       2016-05-20 22:52:50 +08:00
    @Devin 谢谢,我太大意了。
    coolair
        12
    coolair  
       2016-05-20 22:53:38 +08:00 via Android
    你想在 22 点零九执行,可你机器的时间是 13 点 28 ,你搞反了吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5966 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 01:45 · PVG 09:45 · LAX 18:45 · JFK 21:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.