Reputation: 49
I'm trying to automate a python script using crontab and reads many tutorials but unable to get in. I'm on AWS linux instance and wants to run my py file in every 45 minutes. My crontab have following lines
*/45 * * * * /usr/bin/python3 /home/ec2-user/Project-GTF/main.py
and also listing of jobs by crontab -l
shows above line
Let's assume my main.py
files contains a single print statement print("Hello World")
And I also use tmux to alive my terminal all the time.
I suppose that my terminal prints Hello World in every 45 mins but not :( can anyone suggest what's wrong I doing. I don't know much more about cron and never automate a single cron job in my life span :[
Upvotes: 0
Views: 531
Reputation: 6786
Traditionally, stdout and stderr from cron jobs have been emailed to their owner, though on present-day systems where email accounts are dissociated from unix accounts, this has become a bit fuzzy. Your best bet is probably to explicitly redirect output to a file.
(It's possible that there is some AWS specific answer to this, in which case, this being the Internet, someone is sure to tell us. :-) )
Upvotes: 2