I currently have two Droplets that run Ubuntu 16. The first one, Droplet A, is the $5,00 super standard one where my website is built on. While Droplet B is the 80$ a month and has all the databases ready to be queried.
In both the droplets I have created a python backend. What I need is to be able to run a python script on the Droplet B from Droplet A.
How can I do that? This will be so helpful also in the future since we are planning to have many droplets communicating with each other.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Greetings!
There are many paths to doing this, but I’m happy to share mine. I’m a big bash fan, so this is far less fancy of a solution than others might use.
I created a bash script that I use to run commands across all of my servers, and it looks like this:
#!/bin/bash
ssh root@otherserver $@
Let’s say I placed this script in /root named run.sh. To run a command on “otherserver” I might just do this:
sh /root/run.sh commandhere
The “$@” takes everything that follows and shoves it into the command, executed remotely over SSH.
A more professional way might be to expose your application to a network interface and then code in some form of authentication, or firewall it off, then make remote requests that are returned.
Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.