'How to source an env file and then execute Python script via cronjob? [duplicate]
I have several python apps. To run these apps, I must 1st execute the virtual environment by issuing the following command:
source venv/bin/activate
I need to run these files using a cronjob (on Unix).
How can I get the a BASH shell script to execute a python app and make it run in its virtual environment?
Thanks
Solution 1:[1]
You can configure the cron job like this:
*/30 * * * * bash -c "source /the/env; python /the/script.py"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
