如何在 Amazon ec2 中设置 cron 作业 [英] How to cron job setup in Amazon ec2
问题描述
我有一个 Amazon EC2 实例运行我的网站.我需要设置一个 Cron 作业来每 12 小时运行一次我的文件.
如果通过命令行设置文件,请提供详细的步骤.
有人有什么建议吗?
感谢您的时间.
我最近开始在 ec2 实例上使用 Amazon 的 linux 发行版,在为 cron 尝试了各种方法后,我只需要:sudo service crond start
crontab -e
这允许我在不指定用户的情况下将 cron 作业设置为ec2-user".例如:0 12 * * * python3 example.py
事实上,在此处指定用户会阻止它运行.我还在此处发布了此内容.>
I have an Amazon EC2 instance running my website. I need to setup a Cron Job to run my file every 12hours.
if file setup via command line so please give a detail step wise.
Does anyone have any advise?
Thanks for your time.
I recently began using Amazon's linux distro on ec2 instances and after trying all kinds of things for cron all I needed was:
sudo service crond start
crontab -e
This allowed me to set a cron job as "ec2-user" without specifying the user. For example:
0 12 * * * python3 example.py
In fact, specifying a user here prevented it from running. I also posted this here.
这篇关于如何在 Amazon ec2 中设置 cron 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!