How To Automate Or Schedule Jobs Using Python

In this World of Automation everyone wants to save their time and money. Suppose you are System Administrator at a company and you have to run a script after each hour manually then doing this task is very boring. Rather then you would like to Automate this task.

Welcome Guys you are at techsyapa and today we will talk about how you can schedule your Jobs Using Python. In this tutorial we will make a simple water drinking reminder which will remind the user to drink the water after every 1.5 hour. 

In this tutorial we will use pythons apscheduler for scheduling our job , If you are looking for something light then the apscheduler might be the solution for you. 

In this Script our Job is to Remind the User for Drinking the water and we have to schedule this Job after every 1.5 hour , so lets make our hands dirty and write some piece of code.


In the Above code we have used 3 python libraries :-

1. Notify2 :-  For Sending the Notification to the user.

2. Time :-  For Running the Script.

3. Apscheduler :- This is the most important library , this is the main library which is scheduling our Job.

For running this Script or any job scheduling script , we have two options either run the script each time you turn on your computer or second one is make the script as startup Application so what will happen each time you turn on your computer this script will run automatically.

Though this was a simple script of water reminder but you can schedule complex job's such as sending email after every hour and many more with apscheduler. Please note that there are many types of scheduler available in apscheduler so please choose wisely which one will be best for You. For example if the scheduler is the only thing running in your process the use BlockingScheduler. For more information regarding scheduler please read the documentation.

Hope you have liked this blog. For any queries or suggestions please feel free to write it in comment section.      

Comments

Popular posts from this blog

How To Run Jupyter Notebook , Pandas And Numpy On M1 MacBook ?

M1 MacBook Air For Development (A Student Review)

How To Securely Send An Email From Gmail