如何在Amazon EC2中进行作业设置 [英] How to cron job setup in Amazon ec2

查看:91
本文介绍了如何在Amazon EC2中进行作业设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行我的网站的Amazon EC2实例。我需要设置一个Cron Job,每12小时运行一次文件。



如果通过命令行设置文件,请明智地提供详细信息。



有人建议吗?



感谢您的时间。

解决方案

我最近开始在ec2实例上使用Amazon的Linux发行版,在尝试了cron的各种操作之后,我需要的是:

sudo服务crond start

crontab -e

这使我可以将cron作业设置为 ec2-user ,而无需指定用户。例如:

0 12 * * * python3 example.py

实际上,在此处指定用户会阻止其运行。我还在此处发布了。。 p>

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中进行作业设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆