D
D
Denis2015-02-26 16:07:49
bash
Denis, 2015-02-26 16:07:49

How to check the ability to connect via SSH from a script?

How to check that after starting the remote machine SSH started. That is, if it does not start, then wait, and if it starts, then copy files to / from it using SCP.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Vapelnik, 2015-02-27
@Norkotik

usually, when a program succeeds, it returns an exit code. success - 0(zero), any other than zero - failure
you can immediately run scpto copy. if ssh is not running, the result will be failure
so you can start an endless loop and try to work with the server using ssh, using scpuntil the result is 0. as soon as you get it 0, exit the loop - in this case, the files will be downloaded,
you can pause between attempts to connect so as not to hammer the server

I
Igor, 2015-02-26
@Biss

Connect:
ssh [email protected]
After entering the command, it will ask for a password. You can also optionally put the -p key if ssh is on some custom port. Accordingly, if connected - everything is ok with SSH.
With csp, everything is simple. 2 examples below:
1. Copy the file "file.txt" from the remote server to the local computer.
2. Copy the file "file.txt" from the local computer to the remote server.

scp file.txt [email protected]:/some/remote/directory

A
Alexander Litvinenko, 2017-11-20
@artur_kudaev

Hello, how to make these arrows fit the bootstrap?

position: absolute
negative margin-top centered via flex or margin: 0 auto
bootstrap classes don't do this, non-standard element, handles.

D
Dmitry Sokolov, 2017-11-20
@SokolovDmitry

Through nth-child and hang on :before/:after

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question