need help making shell script use two CPUs/cores
I'm not very skilled at writing shell scripts.
#! /bin/sh
for k in $(ls *.JPG); do convert $k -resize 1024 $k; done
I use the above script to batch re-size digital camera photos after I
dump them to my web server. It takes a very long time with lots of new
photos as the server is fairly old, even though it is a 2-way SMP,
because the script only runs one convert process at a time serially,
only taking advantage of one CPU. The convert program is part of the
imagemagick toolkit.
How can I best modify this script so that it splits the overall job in
half, running two simultaneous convert processes, one on each CPU?
Having such a script should cut the total run time in half, or nearly
so, which would really be great.
--
Stan
Reply to: