Multiple batch jobs calling the same batch file causing halt
Moderator: DosItHelp
Multiple batch jobs calling the same batch file causing halt
I have a client that runs many .BAT files overnight. However, I noticed that most of the files call some common .BAT files. My question is this: What happens when two BAT files call the same (secondary) BAT file at the same time? Does this cause any freezing.
I ask because we get some support calls from time to time from the operator who executes these BAT files at 4am. Sometimes, it works fine, but sometimes he tells us that he has to kill a job and rerun them because some batch files take too long.
Most of the files just take seconds to execute. So I am asking myself what could be the problem. Any suggestions?
Note that some files perform CALLs to other BAT files that are also called from other BAT files. One of the files in the chain ends with an EXIT as well.
I ask because we get some support calls from time to time from the operator who executes these BAT files at 4am. Sometimes, it works fine, but sometimes he tells us that he has to kill a job and rerun them because some batch files take too long.
Most of the files just take seconds to execute. So I am asking myself what could be the problem. Any suggestions?
Note that some files perform CALLs to other BAT files that are also called from other BAT files. One of the files in the chain ends with an EXIT as well.
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Well, dos isn't "smart" enough to properly allow a file to be written to *at the same time* by multiple programs or whatever. So if 2 different scripts are trying to write to the same file *at the exact same moment*, then the results will, pretty much by definition, be unpredictable.
So in other words, I have no idea what would happen in that situation. I can say that I've had multiple batch files (running on 1 machine) writing to the same log file and I've never had problems -- but it's only about 20 lines written to in the log file total and I always assume that I've never had a "collision".
If it was me, I'd start re-writing all those batch files to include error checking. You could even use that central log file to allow each one to keep track of where the other batch files are in their progress (in case you need to have 1 batch file finish before another one starts).
So in other words, I have no idea what would happen in that situation. I can say that I've had multiple batch files (running on 1 machine) writing to the same log file and I've never had problems -- but it's only about 20 lines written to in the log file total and I always assume that I've never had a "collision".
If it was me, I'd start re-writing all those batch files to include error checking. You could even use that central log file to allow each one to keep track of where the other batch files are in their progress (in case you need to have 1 batch file finish before another one starts).
I was informed by my client that there is a software called Control-M that actually runs the batch files in the middle of the night. This tool occasionally reports that one batch file is taking too long and must be killed. When I looked at the batch file and ran it in the development environment, the actual time takes about 10 seconds for the batch file to execute. So I ask myself why Control-M (sometimes) reports that the batch file surpassed the 30 minute limit that was set for it.
I did notice one thing. One of the called batch files has an EXIT command in it at the end (last line). Once this EXIT command is executed, the control must return to the calling batch file. Is the EXIT command a reliable one? Can that cause the main (calling) batch file to wait indefinitely?
I did notice one thing. One of the called batch files has an EXIT command in it at the end (last line). Once this EXIT command is executed, the control must return to the calling batch file. Is the EXIT command a reliable one? Can that cause the main (calling) batch file to wait indefinitely?
-
- Posts: 10
- Joined: 21 Nov 2013 01:07
Re: Multiple batch jobs calling the same batch file causing
Hi i am seeking for a technician opportinity with coatings experience. I am Small Batch Technician and responsible for producing products..!