I created a CRON Job to run a Python script at 11.45 everyday. However, when I tested , I see that python script is not getting executed:
45 11 * * * /usr/bin/python2.7 /home/user/Documents/Example/main.py
I think that the problem is with python installation directory since I have multiple python installations and I am not sure which is correct one:
To check python installation, I used following command:
whereis python
Output:
python: /usr/bin/python3.6m /usr/bin/python2.7-config /usr/bin/python
/usr/bin/python3.6 /usr/bin/python2.7 /usr/lib/python3.7
/usr/lib/python3.6 /usr/lib/python2.7 /etc/python /etc/python3.6
/etc/python2.7 /usr/local/lib/python3.6 /usr/local/lib/python2.7
/usr/include/python3.6m /usr/include/python2.7 /usr/share/python
/usr/share/man/man1/python.1.gz
I have added executable permissions to the Python script and its parent directory:
chmod a+x /home/user/Documents/Example/main.py
Note: I want to use python 2.7 for execution of the script. Is there anything that I am doing wrong