I have several projects in Python cloned from GitHub.
Every project needs to first run a setup.py file to install local packages next I run main.py file to execute the code.
How can I run all projects in one code (.py file)?
I would like to run the first project every minute and the second every 15 seconds.
I don't think you need a single
.pyfile, a cron job is what you want.To setup a
crontask, run this command:It will open a text editor for you to create a new job. Write the following lines inside the text editor, for each line put your absolute path to the
main.pyfile where indicated, then save. It should run your first project every minute and the second project every 15 seconds.You can check that your job was saved correctly with the command
crontab -lthat lists yourcrontasks.I invite you to read some documentation on
cronso that you can understand the format used bycrontab. Here is a good link