Hi, it's me again
I'v been googleing for about the last hour and a bit with little success.
What I want:
This post is using similar code to my other post:
http://www.linuxquestions.org/questi...lders.-714468/
Ok so with that other post, all was working fine, until I realized that my server can't really handle any more then 2 or 3 of the "forloop.sh" script running at any one time, and when I had something like 5-7 of them running at once my server pretty much froze

(yea I know, I have a pretty crappy server but it gets the job done... eventually

)
So I thought, well why not just add a queue in so that say only 3 of them can work at a time, and once one of the 3 have finished (if there are any waiting) start it.
From what I found out from google it seems like the "wait" command would be the way to go?
Thoughts:
Current code:
Code:
inotifywait --monitor --format %f -e moved_to -e create /demo/ | while read file; do echo "New files moved in $file";
/forloop.sh $file &
#something like this??
$!
wait if ($! > 3)....Or something.. I'm not sure how it would go :(
done
Looking forward to some awesome help
