By jefftully
I am creating a droplet like this :
new_droplet=$(curl -X POST “https://api.digitalocean.com/v2/droplets”
-d’{“name”:“laminarghost”,“region”:“nyc3”,“size”:“s-1vcpu-2gb”,“image”:“ubuntu-18-04-x64”,“ssh_keys”:[‘$SSH_ID’],“user_data”:null}’
-H “Authorization: Bearer $DO_TOKEN”
-H “Content-Type: application/json”)
after extracting some item from the JSON I am using the following to move a folder and substructure to the droplet:
tar -vczf - * | ssh -o StrictHostKeyChecking=accept-new root@${new_droplet_ip} tar -xzf - -C /opt/
it starts listing files and then stops. 30 percent of the time it announces that the key has been added to known hosts. and proceeds through the rest of the script
the rest of the time it returns ssh: connect to host IP address here port 22: Connection refused tar: -: Wrote only 4096 of 10240 bytes tar: Child returned status 141 tar: Error is not recoverable: exiting now
the ssh takes (15 seconds? ish )to respond, I suspect sometimes it’s longer and times out?
comments and suggestions appreciated
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!
Hello, @jefftully
Are you experiencing the same ssh-timeouts when you’re connected with an ssh-client like Putty or using your terminal?
I will recommend you to check our existing tutorial on how to troubleshoot the connection refused errors in ssh:
Hope that this helps! Regards, Alex
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.