I have a python project which consist of 3 Python scripts that have run indefinitely, and I would like to run them simultaneously. They are:
- web.py: Is a Flask application which will be running forever as the control panel of the project.
- pir.py: Is a script that whatchess the motion sensor to go HIGH, does some stuff, and then keeps looping till the sensor goes HIGH again.
- keypadd.py: Is in a loop till the keypad goes HIGH, reads passcode combinations, does some stuff and loops again.
I tried to run those three files with sh in a shell script. But once the web.py runs, it seems like the other Python files are waiting in a queue untill web.py finish the job and then are going to be executed. But the web.py will never finish the job, because it keeps looping. I would like the scripts to be executed in this order: web.py, pir.py and then keypadd.py.
How can I do that?
Shell script I used:
#!/bin/sh
# launcher.sh
cd /home/pi/Ptoject
sudo python web.py
sudo python pir.py
sudo python keypadd.py