Marco
Marco

Reputation: 1172

Crontab running python scripts

So im trying to make my ec2 instance to automatically run a python script that through Google API generates a csv with Google Analytics data. When i run:

python /path/script.py

it works fine but i set up this line in crontab

@reboot python /path/script.py

And even when the file is generated non data shows up, i believe at some point the script is failing. Any idea what could be causing this? Or how can i debug the problem? is there a log of the instance start so i can see what happens after crontab run the line?

Upvotes: 0

Views: 117

Answers (1)

Ajay2588
Ajay2588

Reputation: 567

Redirect std_err and std_out to a separate file.

@reboot python /path/script.py 2>&1 /tmp/<file.log>

Upvotes: 1

Related Questions