Little crontab tasks in python on mac

type crontab -e to start setting up your cron jobs.

chmod 777 cron_test.py this command change the permissions on the python file.

/1 * * * * cd ~/Documents/Python/cron && /usr/local/bin/python3 cron_test.py >> ~/Documents/Python/cron/cron.txt 2>&1 this line make the cron job start to work on!

  1. /1 **** means the job will run every minute
  2. cd ~/Documents/Python/cron && /usr/local/bin/python3 means navigates to the directory where the python can execute
  3. cron_test.py is the python file you want to execute
  4. >> ~/Documents/Python/cron/cron.txt 2>&1 specifics where to output the logs in case the issues.