Python scripts don’t start on AWS server reboot despite crontab

. (as in single dot symbol, followed by space) in shell is equivalent of source command, so basically you are trying to execute every line in you python script as shell command, which is certainly not something you want to do.

The proper way to execute you script, assuming chmod +x was set is

@reboot /home/ubuntu/config.py
@reboot /home/ubuntu/start_elastic.py

However, for clarity i’d recommend explicitly declaring interpreter in cronjob, like this

@reboot /usr/bin/python3 /home/ubuntu/config.py
@reboot /usr/bin/python3 /home/ubuntu/start_elastic.py

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top