Reputation: 41
I want to run two Python scripts in parallel on a raspberry pi B+, but I don't know how to I do that. Could you please tell me how to do it?
Thanks a bunch!!!
Upvotes: 1
Views: 2208
Reputation: 1192
On the RPi, I run concurrent programs (or scripts) using separate terminal windows. The following script (4fpu.sh) runs four copies of one program and one other. This is useful if you want to monitor progression and avoid confusion on displayed output.
lxterminal -e ./RPiTemperature Pases 25, Seconds 30
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 1
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 2
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 3
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 4
Upvotes: 0
Reputation: 851
I've not used a raspberry pi but I'm assuming it is using Bash or something similar and you can start 2 scripts simultaneously on that by running...
./script1.py & ./script2.py &
The ampersand sends the script to the background to be ran but the output still gets printed to stdout.
The scripts will start by printing out something like...
[1] 9141
[2] 9142
The right number is the PID (Process ID) and that can be used to stop the script by running...
kill 9141
Upvotes: 1