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.
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.
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)
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