I spent lots of time on this tiny problem, I would like to tell you, all you see on other websites which teach you to use ‘crobtab -e’ or other method in Linux won’t work in AWS, it looks AWS system totally ignore those settings. I don’t like those guys copy from each other without actually validating it, it really waste audiences’ lots of time.
The only way to schedule regular tasks in aws via cron is to make a new file without any extension under this fold:
This is my setting:
This means to use the ‘root’ role to:
- go to directory /home/ubuntu/aushare, remember those environment path won’t work automatically in cron;
- execute /home/ubuntu/anaconda3/bin/python /home/ubuntu/aushare/ASXScrapShareDailyPrice.py;
- log to /home/ubuntu/dailyPriceUpdate.log;
- 2>&1 means log errors to the file as well.