[Chicago-talk] Script design question

Steven Lembark lembark at wrkhors.com
Mon Dec 19 10:29:58 PST 2005


> I know it's not Perl, but in the past, I've done something like this:
> 
> Set up a GNU Makefile that looks like:
> 
>     OUTPUTS= $(patsubst %, /export/backups/group%.bkp, A B C D E F [upto]
> Z)     all: $(OUTPUTS)
>     /export/backups/%.bkp:
>             imsbackup -i -f- /gsbims/$* >$@
> 
> Then execute this with "make -j4 all" (might need gmake or gnumake).
> 
> The -j4 will keep 4 jobs running at all times, going on to the next
> one as soon as one finishes.  Works real nice.
> 
> GNU make can also work off loadaverage instead, if that's your real
> concern.

That or use Schedule::Depend, which will happily dispatch
shell or perl without having to wrap everything in shell
#!'s. 

As a heuristic, you can sort the backups from largest
to smallest and run them N-way parallel with Schedule::Parallel
to get a balanced average runtime. This will also give you
a fairly predictable system load.

-- 
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
lembark at wrkhors.com                                     1 888 359 3508


More information about the Chicago-talk mailing list