Link to home
Start Free TrialLog in
Avatar of Emmanuel Gleizer
Emmanuel GleizerFlag for Israel

asked on

Limit the quantity of process created in parallel in the Task Scheduler 2008

Hi all!
Problem: My code create too much process.
Question: How to limit the quantity on process created in parallel.

Background: for backup zip7 and the Task Scheduler of window 2008 is used. A task performs (Action) zip of all the files in a directory. The result is 1 zip for each file (I don't want 1 zip with all the files).

the action (in the Task Scheduler) is: cmd
the arguments are:
/C FOR %i IN (*.nsf)  DO  "C:\Program Files\7-Zip\7z.exe"  -bd u "\\Server_name\Backup\%~ni.zip" "%~fi">>c:\resuZip.log

Don't care too much if you're not familiar with the syntax, it works, this is not the problem.
The problem is that FOR creates for *each* file a process (like a fork in C) and the server nearly collapses.
How could I limit the creation of parallel tasks ?

Thanks in advance.
Emmanuel
SOLUTION
Avatar of TechnoChat
TechnoChat
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Emmanuel Gleizer

ASKER

Well this is an idea but, I'm afraid it will not help in my case. With this option It would still *create* ~ 250 process that do ZIP: which is intensive for my server.
It would help if the process *creation* itself is done when the system is idle (which would occures when the first ZIP has ended) it would be almost sequential.
I could even accept a solution in which only ONE process is created that will care of the file one after the second.
 
This command line tool might help you out..

http://www.activeplus.com/Products/RunFirst

Thanks
Saugata
This solution will put (as I understand it) all the process on ONE core... well if put them in a sequence it could be a solution. But if it put them in parallel on one core well the process will nearly never end...
I'll try
Just give it a try, Hope for the best..

Thanks
Saugata
I found a better solution (I'm testing it) google for "wait for command to complete \before continuing batch file"
start /wait cmd /c .....
would post if it works
BTW I tried to use the Runfirst... but didn't find the syntax for "Option starup parameters"  
This runfirst tool only works with the executable without any Option starup parameters. But if you are on vista/w7/2008, then you can user start command for the same.

EG.
start /AFFINITY 1 notepad.exe

Thanks
Saugata
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Most important thing is to solve the problem, no mater it solve by your self or by taking help from some one else. We all here to help each other, and share our knowledge to solve the problem faster, caz we can't live with our problems :)
And thanks for your comments..

Thanks
Saugata
The main problem is that I didn't identify what the problem was: In fact NO parallel collapsing server resources… Thanks to TechnoChat for his different ideas