I have two active RPi's. They both have the script:
adxl345test.py
This script collects data from an accelerometer. I usually start the script on one RPi and then start the script on the other RPi. However now I want to start the scripts at the same time. So...
- Is it possible to run the scripts from both RPi's on one RPi?
So that one RPi starts running both its own script and an external script from the other RPi.
The RPi's are networked via their own WiFy (wireless). No internet connection. And at the moment the latency doesn't matter. Just want to type one command on one RPi.
Each RPi has an accelerometer attached. If I only have one RPi I will miss out on the data from the other RPi.
I trigger the scripts on each RPi by writing sudo python adxl345test.py
in the console and then pressing Enter. The clocks are synced with PTPd. What I'm looking for is to trigger the scripts by writing a single command in the console of one RPi.
I found a way to run both script through one command. Here it is:
pi@Sensor1:~ $ sudo python adxl345test.py & ssh pi@ip sudo python adxl345test.py
However since I use ssh the second RPi requires a password before it runs the script. So...
- Is there a way to skip the password?
- Can you write the password directly in the abovementioned command?
Using sshpass (sudo apt-get install sshpass
) I managed to type the password directly into the command. The command is:
pi@Sensor1:~ $ sudo python adxl345test.py & sshpass -p 'password' ssh pi@ip sudo python adxl345test.py
I can now start collecting data with only one command however they still don't start at the same time (around 1s off).
- Is it possible to make them start even closer to eachother timewise (0,1s or less)?
- Also how do I stop recording data? Normally I would use Ctrl+c but that only works when running a single script on one RPi.