Easiest way to Run a Python Script in the Background
<p>The easiest way of running a python script to run in the background is to use <strong><em>cronjob feature (in macOS and Linux)</em></strong>. In windows, we can use Windows Task Scheduler.</p>
<p>In Mac or Linux, open the terminal using the following command to check what jobs are running in the background</p>
<blockquote>
<p>crontab -l</p>
</blockquote>
<p>Now, to edit the list type the following command</p>
<blockquote>
<p>crontab -e</p>
</blockquote>
<p>You can then give the path of your python script file to run at a specific time by giving the time particulars. Now enter the following and press <code>CTRL+O and CTRL+X </code>to save and exit.</p>
<p>Presently I have two jobs scheduled to run in the background as can be seen from the below screenshot</p>
<p><a href="https://medium.com/analytics-vidhya/easiest-way-to-run-a-python-script-in-the-background-4aada206cf29"><strong>Learn More</strong></a></p>