I have developed a Python application which needs to call a bash script stored in another computer (Raspberry Pi).
I don't need to get any return value nor confirmation.
What are the feasible ways to do that?
Thanks!
I have developed a Python application which needs to call a bash script stored in another computer (Raspberry Pi).
I don't need to get any return value nor confirmation.
What are the feasible ways to do that?
Thanks!
From the shell you could do it like this:
ssh pi@theraspberrypi "./myscript"
To run a shell command from in Python:
import os
os.system("ssh pi@theraspberrypi ./myscript")
Or, as Eevee suggested below:
import subprocess
subprocess.call(['ssh pi@theraspberrypi ./myscript'], shell=True)
Of course, you will probably want to put your public key in the raspberry pi's authorized_keys file so it won't prompt for a password.
subprocess
, which will save you from mucking about with shell quoting and escaping. (though in this case, the quotes aren't necessary anyway.)