Is it possible to:
- execute sftp command on remote machine and download a file (
- then, send download to background, so I can turn my local computer off
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
screen on machine B, start the download and detach afterwards:
On machine A:
On machine B:
screen sftp user@C get some_file.tar.gz Ctrl-a d logout
Never tried but could work.
Edit: later, log back in and use
screen -x to reconnect to the running session. Then, shut it down properly so that it isn't consuming the server's resources.
If you just want the "detach" feature of screen, there's a program called "dtach" that provides only that feature.
Putting the character & (ampersand) behind a command runs it in background. However, I don't know how to do it after a command has already been executed, nor do I know whether this works on remote machines.
There are a number of solutions to this issue.
One option is to use the
screen command, however seems a little complex.
The best way I have found is sending the job to the background.
In your case the command would be
scp user@machine:~/filename.ext /tmp & scp -r user@machine:~/dirname /tmp &