Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cron job setup in Amazon ec2

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.

like image 242
Raju Dudhrejiya Avatar asked Jun 12 '15 15:06

Raju Dudhrejiya


2 Answers

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.

like image 197
j3py Avatar answered Sep 23 '22 01:09

j3py


It's just normal cron.

See: HowTo: Add Jobs To cron Under Linux or UNIX?

like image 36
John Rotenstein Avatar answered Sep 24 '22 01:09

John Rotenstein