Ubuntu – How to set up a cron job to run every 10 minutes?

cronpythonscripts

I have a python script, and i'd like to make it run every 10 minutes, how can i do this? Thanks in advance.

• Make the script executable by:

chmod u+x /path/to/script.py


Note that, you need a shebang (i.e. indicate interpreter in the first line of the script), for python2:

#!/usr/bin/env python2


For python3:

#!/usr/bin/env python3

• Open your cron table by

crontab -e

• Add the following cron entry:

*/10 * * * * /path/to/script.py


Note that, if the script is not executable you can indicate the interpreter on the go:

• For python2:

*/10 * * * * /usr/bin/env python2 /path/to/script.py

• For python3:

*/10 * * * * /usr/bin/env python3 /path/to/script.py