K
K
Kirill Sidorov2012-05-14 11:56:15
linux
Kirill Sidorov, 2012-05-14 11:56:15

Silent ssh login and wait for startup?

I received the need to create backups every week, figured out the algorithm of actions, I would like to automate. The servers are located in the Scalaxy cloud, there is a backup server with a large partition where backups from the servers are poured. I copy the entire root image of the partition with the dd command and redirect everything via ssh to the backup server. During the main time, to save money, the server is turned off, it turns on on demand when you need to make a backup. The algorithm turned out like this:

  • turn on the instance
  • waiting for the server to load
  • execute dd if=/dev/sda1 | ssh [email protected] "dd of=/home/backups/bck"
  • waiting for copying
  • turn off the instance

Actually, I don’t know how to connect via SSH without asking for a password and how to wait for the server to load? Prompt, guru of administration!

Answer the question

In order to leave comments, you need to log in

5 answer(s)
G
Gleb Starkov, 2012-05-14
@colonel

No password: keys (ssh-keygen)
Backups: rsync (it's very fast, it doesn't copy everything, only differences)
Server off: ping (no?)

V
Vlad Zhivotnev, 2012-05-14
@inkvizitor68sl

About the keys.
Connect with a command like:

while :; do ssh blablabla -o ConnectTimeout=10 && exit 0 || sleep 10; done

J
jov, 2012-05-14
@jov

And why manually start copying?
1. Copy the key of any user included in the disk group (at least for me on gentoo so), well, or root'a, to the instance for backups. Example .
2. We add to the download a script that directly performs copying. If I were you, I would listen to colonel and use rsync. At the end of the script, I would put the poweroff command. Everything, the script worked, the instance turned off.

A
Alexey Akulovich, 2012-05-14
@AterCattus

As an option, to check the server startup, you can set the key "ssh -o ConnectTimeout=10" (seconds).
And try to reconnect.

@
@mgyk, 2012-05-15
_

Try duplicity instead of manual dd. Maybe you can turn on the server on a schedule or pull it through the scalas API?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question