5 Answers
5

If you did not have the foresight to launch the process with nohup, you can also background the process and disown the bash session while it is running.

Open ssh terminal to remote server

Begin scp transfer as usual

Background the scp process (Ctrl+Z, then bg)

Disown the backgrounded process (disown)

Terminate the session (exit) and the process will continue to run on the remote machine.

One disadvantage to this approach is that the file descriptors for stdout and stderr will still contain references to your ssh session's tty. The terminal may hang when you try to exit because of this. You can work around this by typing ~. to force close your ssh client (that escape sequence must follow a new line...see also ~?). If the process you are abandoning writes to stdout or stderr, the process may exit prematurely if the tty buffer overfills.

screen, cron, at, and nohup can also be used. There is more than one way to skin a cat!~~ The advantage of using disown is that you do not have to plan in advance. You can be halfway through the file transfer and decide, "oh bugger, I need to log out now", and you can just background it and disown.

The advantage of using Screen is that if the network drops out at any time, your session will remain active, but you must get into the habit of using Screen. Using a scheduler such as cron is the best solution if this is a periodic sort of task that you want to automate.