Running an operating system command from CLI


We have devices where we installed our own software/application, and this application can be updated (deployed) using a systemctl command from the operating system, for example:

systemctl start deploy

We would like to run this command to deploy our software on all the devices of a certain application, but because we have many devices, it would be good to automate this. I know we can write a script with the python resin sdk iterating all the devices of our application, but I don’t see something in the API to run an operating system command. Is this possible?


Hi @flavia,

What does the start deploy command actually do? From what I understand, you want the ability to run a single command via SSH on all the devices in your application, is that correct?

Hi Shaun,

Yes, exactly, that’s what I want.

The command I want to execute gets the latest code of our application from a code repository and deploys it on the device.

Hmm, I’m not sure what problem you are trying to solve with this approach. is built to do this for you, we actually started building resin this way in the beginning with a git pull model, but this starts breaking very quickly, hence the move to docker and a more robust distribution mechanism.

Additionally running the CLI to do this command will probably lead to some very weird failures because the systemctl start deploy will ultimately change the state of the container which is fine, but when the container restarts device reboots, etc. the container state will be reset to its original state, so you would have to run that CLI command every time you start the container up, which would require a bunch of tooling with the CLI.

If you can tell me which parts of resin are causing you to want to go down this path, then I am sure we can suggest some better alternatives, we have done the git pull model before and moved away from it very quickly for many reasons.


Yes, it’s true. It’s not the right way to use Resin :).