1

If someone (i.e. my VPS provider), does the following command, how can I from my ssh know if the copy is complete? Thanks

cp /home/abc/hugeDir /home/cba
2
  • In Linux/Unix commands are synchronous unless you send them to background (e.g. by a ` &` appended). The cp command is visible to all users, unless the admin has enabled obfuscations.
    – ott--
    Jun 21, 2013 at 21:04
  • Your question is ambiguous. Some answerers, including the one you accepted, assume you mean "has completed" while others assume you mean that whether anything was missed. Jun 22, 2013 at 2:03

4 Answers 4

5

You can just check the process list:

ps aux | grep cp

If the prcoess is finished, it will vanish from the list.

1

Use md5deep on the source directory and when they tell you the copy is complete use it on the destination directory, the output hash should be the same.

0

There are many approaches; however, I find one to be very easy and simple to apply.

I recommend to use rsync and start a data transfer; if no files are copied, the initial copy must have been complete.

Example command:

rsync -Hav --progress /home/abc/hugeDir /home/cba

If you want to know what the options mean simply type in "man rsync".

1
  • I don't think that's what the OP means.
    – Sven
    Jun 21, 2013 at 20:57
0

If you know how much they are supposed to transfer you can watch du -hs /path/to/target/dir to see when it reaches the right size.

3
  • You can edit answers, no need to delete and repost.
    – Sven
    Jun 21, 2013 at 21:44
  • Yeah, but since the answer contained two solutions it was better to split it. Also, the other solution was, as you said, infeasible.
    – l0b0
    Jun 21, 2013 at 21:45
  • Running du in watch could be very expensive. Jun 22, 2013 at 2:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .