On Mon, Jan 30, 2012 at 6:06 PM, lina <lina.lastn...@gmail.com> wrote:
> Hi,
>
> ( sorry if it a bit off-topic)
>
> 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?

#!/bin/bash

for i in {0..19}
do
sleep 60 &

while ($((ps au | grep sleep | wc -l)) > 9)
do
sleep 2
done

done

sorry the subject of the email should be "refrain using too many
processors at the same time."

above one not working, complained:

.sh: line 8: ps au | grep sleep | wc -l: syntax error in expression
(error token is "au | grep sleep | wc -l")


>
> Thanks,


-- 
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/CAG9cJmncj-b=bfvp-qyqbnmgggrbgnvsf5o-a5+8ftacs2v...@mail.gmail.com

Reply via email to