I'd like to be able to launch a command now, but have it start only after an older command (which is already running) completes.
For example, say I'm copying a large file over the network, an action that already saturates my network bandwidth. I then want to copy a second large, less important file to the same destination, but in order for the first copy to finish asap I'd like to delay this second copy until after the first finished.
Normally I would do this:
10 minutes ago:
cp large_file_urgent ~/networkmnt/
Present time:
sleep <some_guesstimated_time_for_old_cp_to_finish> && cp large_file_lessimportant ~/networkmnt
Is there a smarter way to do this? Can I somehow tell the second cp
to wait until the first cp
's PID terminates?
This is on Ubuntu 13.04 (in case that's of any consequence).