5

I have 4 Raspberry Pi compute modules, running at different locations and I would like to run a script from the server that would connect and update the pi's with the latest version of the file found on the server. How would I do this? The file I would like to update is running on the pi, so I believe I would have to update and send a restart command, but I am not sure. These pi's would also be on different networks, and would not have static IP's, so simply using ssh I don't believe would work. Note they would each be connected to the internet via a 3G modem, and they would have 2 way communication with the server.

6

The first question has to be what the access to the 4 individual RPis is from the outside. Can you access them from your server? Can they access the server? The answer to that question is going to determine the viable solutions.

Running the program on the 4 remote RPi as a service sounds like part of the solution. Write the appropriate startup scripts (see man update-rc.d, this link for a discussion). If properly written, it will be easy to stop and restart the program as needed.

As to updating the program itself, rsync (in combination with ssh) sounds like an easy solution. (see man rsync). You could initiate rsync from "inside" (the remote location) or "outside (your server) as needed, depending on connectivity. If it is program source code that needs to be updated, you might use an automated git process.

If the program has significant installation requirements, you might investigate creating a private deb repository and having the RPis update with apt-get regularly.

  • 1
    They have 2 way communication with the server, but ssh won't work since they don't have a static IP – FreshTendrils May 20 '15 at 14:30
  • 2
    @FreshTendrils sure it will. Send a message to the host that contains their ip. – Jacobm001 May 20 '15 at 16:37
  • 1
    Or a dynamic dns service would also work if you configure the remotes to update their entry on change of IP. Alternately, have the remote machines initiate an outbound ssh tunnel to the server for a full-time VPN-like connection if you need frequent updates. Of course, the owner(s) of the remote network(s) should be consulted before you install a potential back-door onto their network! – bobstro May 20 '15 at 17:44
2

It's probably worth looking into resin.io. It's a deployment and management platform for devices like rpi and has its own vpn to circumvent the IP issues with 3g so should be perfect for your use case.

(disclaimer: I work for resin.io)

0

Mender.io is having OOTB support for multiple RPis. You can read more here: https://hub.mender.io/t/raspberry-pi-3-model-b-b/57

Also, there is Raspbian support with the details mentioned here: https://hub.mender.io/t/raspberry-pi-3-model-b-b-raspbian/140

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.