On Mon, Jan 30, 2012 at 06:06:06PM +0800, lina wrote: > I have a script like > > #!/bin/bash > for i in {0..108} > do > > some job will run for mins & > done > > Here I used & for some kinda of parallel. > but there is a problem, > I wished at most it only run 8 jobs simultantly, no more than 8, once > finished, a new job can continue, > Some suggestions?
how about instead of one script, running 8 scripts from cron, each has its own lock file: ------------------------------------ #!/bin/sh #script no.1 LOCKFILE="$HOME/lockfiles/lock_1" if [ -f $LOCKFILE ]; then exit 1 else echo "green light .." fi date -u > $LOCKFILE do something rm $LOCKFILE ------------------------------------ -- Chen Wei -- 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/20120130140831.GB2756@Tungsten.DarkStar