How To Schedule Python Scripts As Cron Jobs With Crontab (Mac/Linux) - Python Task Automation

Published: 07 January 2021
on channel: Patrick Loeber
65,152
1.2k

In this tutorial, we learn about cron jobs and how to schedule commands and Python scripts in the terminal via crontab (for Linux and Mac). This allows us to run commands on a repetitive schedule. We specifically look into running Python scripts as cron jobs. There are a couple of pitfalls where we have to be careful. We also learn how to schedule jobs with a virtual environment.

✅ Write cleaner code with Sourcery, instant refactoring suggestions in VS Code & PyCharm: https://sourcery.ai/?utm_source=youtu... *

⭐ Join Our Discord :   / discord  

🚀🚀 Get monthly Python and ML Tips:
https://www.python-engineer.com/newsl...

🚀🚀 SUPPORT ME ON PATREON:
  / patrickloeber  

If you enjoyed this video, please subscribe to the channel!

Timeline:
00:00 - Introduction
01:20 - Cron syntax
06:00 - Crontab
07:15 - Python scripts
10:40 - Virtual Environment

Code:
https://github.com/patrickloeber/pyth...

You can find me here:
Website: https://www.python-engineer.com
Twitter:   / patloeber  
GitHub: https://github.com/patrickloeber

Music: https://www.bensound.com/

Photo by Kari Shea: https://unsplash.com/photos/1SAnrIxw5OY

#Python

----------------------------------------------------------------------------------------------------------
This is a sponsored or an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏