如何在Ubuntu 14.04上运行每日cron作业

时间:2016-05-28 06:47:21

标签: cron ubuntu-14.04

我写了一个shellcript(.sh)并把它放在这里(我在脚本上也做了chmod +x):

/etc/cron.daily/

我还需要做些什么才能让它发挥作用吗? 因为我看到了:

May 28 05:32:50 ip-172-31-xx-xx dhclient: DHCPREQUEST of 172.31.xx.xx on eth0 to 172.31.xx.1 port 67 (xid=0x7340709e)
May 28 05:32:50 ip-172-31-xx-xx dhclient: DHCPACK of 172.31.xx.xx from 172.31.16.1
May 28 05:32:50 ip-172-31-xx-xx dhclient: bound to 172.31.xx.xx -- renewal in 1607 seconds.
May 28 05:59:37 ip-172-31-xx-xx dhclient: DHCPREQUEST of 172.31.xx.xx on eth0 to 172.31.xx.xx port 67 (xid=0x7340709e)
May 28 05:59:37 ip-172-31-xx-xx dhclient: DHCPACK of 172.31.xx.xx from 172.31.xx.xx
May 28 05:59:37 ip-172-31-xx-xx dhclient: bound to 172.31.xx.xx -- renewal in 1702 seconds.
May 28 06:17:01 ip-172-31-xx-xx CRON[17051]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
May 28 06:25:01 ip-172-31-xx-xx CRON[18496]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))

但是我的工作没有运行(它将.tar写入S3并没有看到它)

编辑1

35 7 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )/etc/crontab

的内容

因此,如果/usr/sbin/anacron的执行有效,则不会执行我的cron.daily。因此,如果我删除/usr/sbin/anacron,它将只执行我的/etc/cron.daily而不是它的工作原理。 但为什么/usr/sbin/anacron在那里呢?我在文件中找不到anacron。我可以在/etc/crontab中删除它吗?

0 个答案:

没有答案
相关问题