On Sun, Jan 09, 2011 at 10:05:43AM -0600, Stan Hoeppner wrote:
> 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.

Not really 2 but ...

Either use "make" to run controlled number of process or just do
something along

for k in $(ls *.JPG); do convert $k -resize 1024 $k >>log.txt 2>log2.txt &; done



-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110114154648.ga16...@debian.org

Reply via email to