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

如何在Ubuntu 14.04上运行每日cron作业,cron,ubuntu-14.04,Cron,Ubuntu 14.04,我已经编写了一个shell脚本(.sh)并将其放在这里(我还在脚本上做了一个chmod+x): 我还需要做些什么才能让这一切顺利进行吗? 因为我看到: 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

我已经编写了一个shell脚本(.sh)并将其放在这里(我还在脚本上做了一个
chmod+x
):

我还需要做些什么才能让这一切顺利进行吗? 因为我看到:

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

357***根测试-x/usr/sbin/anacron | |(cd/&runparts--report/etc/cron.daily)
/etc/crontab

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

您的脚本名是什么?它是否以
.sh
结尾?是的,它以扩展名.sh结尾。这可能是您的问题,来自页面:“尽管目录名称中包含句点,但运行部件将不接受包含句点的文件名,并且在遇到它们时会自动失败(错误#38022)。重命名文件或使用符号链接(无句点)改为。在重命名文件
myscript
而不是
myscript.sh
时,查看它是否有效。如果是的话,我会把它贴在答案里,你可以接受。你可以明天测试它。我会让你知道的
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 ))