dropthebass
Posts: 4
Joined: Mon Jul 17, 2017 5:42 am

Talk to several Raspistill instances over network - PHP

Thu Jul 27, 2017 3:57 pm

I am trying to broadcast the Raspistill command over my local network to all Pis that are connected. So far, I have an Apache server running on one Pi with that server hosting a PHP script. The PHP script just has an exec() function giving a raspistill prompt as its argument. When I go to the localhost on my browser, only the main Pi takes a photo. How can I broadcast this command over the network to all Pis? I am trying to avoid using polling because I want all scripts to be on the main Pi only.

User avatar
thagrol
Posts: 280
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Talk to several Raspistill instances over network - PHP

Thu Jul 27, 2017 4:55 pm

One possible approach would be as follows:

Configure all "slave" Pis to allow login from the "master" (pi running apache) via ssh with public/private keys.

Have apache run a script something like this:

Code: Select all

#pseudo code
for pi in list_of_pis
	ssh usr@pi 'raspistill <parameters>'
I don't know apache, nor which program language you're using to be more specific. Sorry.

dropthebass
Posts: 4
Joined: Mon Jul 17, 2017 5:42 am

Re: Talk to several Raspistill instances over network - PHP

Thu Jul 27, 2017 5:14 pm

I am using PHP at the moment, but I have tried running a Python CGI script as well to no avail.

User avatar
thagrol
Posts: 280
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Talk to several Raspistill instances over network - PHP

Thu Jul 27, 2017 10:37 pm

Not able to help with php or with using python for cgi-bin scripts but I diid have a project using the ssh based approach I outllined above.

Have a look at https://github.com/thagrol/clusterctl specifically the function do_command in clusterctl.py.

Return to “Other languages”

Who is online

Users browsing this forum: No registered users and 5 guests