Waiting and Watching

Waiting and Watching: Waiting for Things: watch, until and timeout, Running Work in Parallel: &, wait and xargs -P.

Updated

  1. Waiting for Things: watch, until and timeout (Journeyman): watch reruns a command every few seconds and shows its latest result, an until loop waits until a server answers, and timeout stops a command that takes too long, with exit code 124, so a script never waits forever.
  2. Running Work in Parallel: &, wait and xargs -P (Freelancer): Commands that each take a while can run side by side: & starts each one in the background and wait holds the script until all of them have finished, while xargs -P runs a set number at a time, so 12 one-second photo resizes take 3 seconds instead of 12.