Macos – way to pause an already running scp process

macosscp

I'm copying a large file using scp, and realized that the destination may not have enough space for it to finish. Is there a way I can pause it, possibly for several hours, and resume later? Also, if it fails (no space left on device), will I be able to resume it once I've cleared some space?

(Note that scp is already running; solutions like using a different program will not work.)

Best Answer

You can pause a process with SIGSTOP and later continue it with SIGCONT. (See kill -l for a list of signals and use ps to get the process ID).

However there is a fair chance that this will not work. E.g. if you have a router between your source and destination which notices and 'cleans' a dead connection. Most SOHO routers seem to do this because cleaning connections means less memory use. (And thus they can build cheaper routers).

If that happens you will either need to copy again with scp or you can use rsync.

Rsync has the advantage that it compares already existing files and does not needlessly copy data. In your case it should detect an already present, partially uploaded file and only upload the remainder of the file

Syntax would be rsync -v -e ssh /home/my_file username@destination.host.tld:~

-v for verbose. -e "ssh options" to specify the ssh as remote shell.

If your data is compressable then you might want to add -z to compress the data.

Related Question