Monotoring Execution for some time using scripts
Moderator: DosItHelp
Monotoring Execution for some time using scripts
Hi,
I am new to the world of scripting area.
I have a scenario in Which i am writing script in which call other .bat scripts which usually takes 26 minutes for execution.
What i want to do is like i want to monitor them.
Say if it takes 26 minutes to execute then i want to create a scripts which will set start time for each batch file that is executing and will give some time frame like 35 minutes.
If it do complete its execution in 35 minutes the it should send some message sat it should create a file.
Can it be achieved using DOS scripts.
My OS is Windows Server 2003 R2 x64 edition.
How it can be done?
Which commands can be used ?
Thanks,
Mahesh
I am new to the world of scripting area.
I have a scenario in Which i am writing script in which call other .bat scripts which usually takes 26 minutes for execution.
What i want to do is like i want to monitor them.
Say if it takes 26 minutes to execute then i want to create a scripts which will set start time for each batch file that is executing and will give some time frame like 35 minutes.
If it do complete its execution in 35 minutes the it should send some message sat it should create a file.
Can it be achieved using DOS scripts.
My OS is Windows Server 2003 R2 x64 edition.
How it can be done?
Which commands can be used ?
Thanks,
Mahesh
Re: Monotoring Execution for some time using scripts
Hi,
I have following script.
REM @echo off
set USER=dev_odi_repo
set PASSWORD=bridge125
set DB=OMPODIT
SET WORK_BASE=D:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\agent\bin
set LOGDIR=%WORK_BASE%\scripts\work3
set TEMPDIR=%WORK_BASE%\scripts\temp3
set SQLDIR=%WORK_BASE%\scripts
set ORACLE_HOME=D:\oracle\product\11.2.0\dbhome_1
call %WORK_BASE%\odi_pkg_tata_master_omp.bat
call %WORK_BASE%\odi_pkg_bur_master_omp.bat
call %WORK_BASE%\odi_pkg_bet_master_omp.bat
call %WORK_BASE%\odi_pkg_bar_master_omp.bat
call %WORK_BASE%\odi_pkg_poz_master_omp.bat
CALL %WORK_BASE%\scripts\transformation_master_omp.bat
Now i want to set a start time for execution of call %WORK_BASE%\odi_pkg_tata_master_omp.bat and need to check if its been completed in 35 minuts.
If yes the nsame thing for next one . It will go as of it till the last file.
And if i encounter that its running for more than 35 minutes then it should be write say FAILURE in some text file.
Can it be achieved ?
Thanks, Mahesh
I have following script.
REM @echo off
set USER=dev_odi_repo
set PASSWORD=bridge125
set DB=OMPODIT
SET WORK_BASE=D:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\agent\bin
set LOGDIR=%WORK_BASE%\scripts\work3
set TEMPDIR=%WORK_BASE%\scripts\temp3
set SQLDIR=%WORK_BASE%\scripts
set ORACLE_HOME=D:\oracle\product\11.2.0\dbhome_1
call %WORK_BASE%\odi_pkg_tata_master_omp.bat
call %WORK_BASE%\odi_pkg_bur_master_omp.bat
call %WORK_BASE%\odi_pkg_bet_master_omp.bat
call %WORK_BASE%\odi_pkg_bar_master_omp.bat
call %WORK_BASE%\odi_pkg_poz_master_omp.bat
CALL %WORK_BASE%\scripts\transformation_master_omp.bat
Now i want to set a start time for execution of call %WORK_BASE%\odi_pkg_tata_master_omp.bat and need to check if its been completed in 35 minuts.
If yes the nsame thing for next one . It will go as of it till the last file.
And if i encounter that its running for more than 35 minutes then it should be write say FAILURE in some text file.
Can it be achieved ?
Thanks, Mahesh
Re: Monotoring Execution for some time using scripts
Code: Select all
for /F "tokens=1,2 delims=:" %%a in ("%time%") do set /A "baseTimePlus35=((1%%a %% 100)*60)+%%b+35"
call %WORK_BASE%\odi_pkg_tata_master_omp.bat
call :CheckLapse
call %WORK_BASE%\odi_pkg_bur_master_omp.bat
call :CheckLapse
call %WORK_BASE%\odi_pkg_bet_master_omp.bat
call :CheckLapse
call %WORK_BASE%\odi_pkg_bar_master_omp.bat
call :CheckLapse
call %WORK_BASE%\odi_pkg_poz_master_omp.bat
call :CheckLapse
rem Etc...
:CheckLapse
for /F "tokens=1,2 delims=:" %%a in ("%time%") do set /A "timeNow=((1%%a %% 100)*60)+%%b"
if %timeNow% gtr %baseTimePlus35% echo FAILURE > someFile.txt
set /A baseTimePlus35=timeNow+35"
exit /B
Previous code must include the day if the 35 minute lapse may pass over midnight. If you need it, please request it.
Re: Monotoring Execution for some time using scripts
Also see the date and time functions on this site:
http://www.commandline.co.uk/lib/treeview/index.php
Regards
aGerman
http://www.commandline.co.uk/lib/treeview/index.php
Regards
aGerman
Re: Monotoring Execution for some time using scripts
My interpretation of the task is: time a routine and if it is still running after 35 minutes then echo an alert.
I assume the OP then wants the task killed and to continue with the next task in the list, but maybe not.
The solution above is asynchronous and will wait for each task to complete before continuing.
I assume the OP then wants the task killed and to continue with the next task in the list, but maybe not.
The solution above is asynchronous and will wait for each task to complete before continuing.
Re: Monotoring Execution for some time using scripts
Maheshgx wrote:Now i want to set a start time for execution of call %WORK_BASE%\odi_pkg_tata_master_omp.bat and need to check if its been completed in 35 minuts.
If yes the nsame thing for next one . It will go as of it till the last file.
And if i encounter that its running for more than 35 minutes then it should be write say FAILURE in some text file...
I think these words are clear enough that they do not require interpretations or assumptions...
However, I may be wrong and you may be right, but if this is the case; where is your synchronous solution to this problem? Otherwise I don't understand the purpose of your post...

Re: Monotoring Execution for some time using scripts
Aacini wrote: Otherwise I don't understand the purpose of your post...
I think I was quite clear. You'll have to wait for acknowledgement from the OP before you know if your interpretation is right.
Re: Monotoring Execution for some time using scripts
I read this topic and posted a solution with the objective to help the OP.
I have no doubts about the original request. If I would had questions on the task to solve, it is customary to ask the OP to clear they before even try to think about a solution. Didn't know you this?
Are you trying to state that I must remain waiting for OP's acknowledgment before I get satisfied with my answer because YOU have a different interpretation of the question?
If the OP indicate he wants the synchronous solution instead I will not worry, I will just try to solve it...
I have no doubts about the original request. If I would had questions on the task to solve, it is customary to ask the OP to clear they before even try to think about a solution. Didn't know you this?

foxidrive wrote:You'll have to wait for acknowledgement from the OP before you know if your interpretation is right.
Are you trying to state that I must remain waiting for OP's acknowledgment before I get satisfied with my answer because YOU have a different interpretation of the question?



If the OP indicate he wants the synchronous solution instead I will not worry, I will just try to solve it...
Re: Monotoring Execution for some time using scripts
Are your pants on backward today? Something is irritating you out of all proportion to my post...
Re: Monotoring Execution for some time using scripts
Well, let me explain myself...
When a question have a valid answer already it is not common that an additional post criticize the first answer, unless of course that the second post fix an error, or present a different solution, or propose any constructive criticism. However your first post does not contain anyone of these cases, but it is a pure negative criticism on my answer. Note that you had not used any affable term (like "I think", "perhaps", "it would", etc) in your post.
I read your first post and, confused, asked you for its purpose, but your reply was "quite clear": another pure and simple criticism to my answer.
If you still don't see my viewpoint, let me do it clearer. Your first two posts above have this meaning for me:
Of course, I get offended because these words...
Perhaps I misunderstood something?
When a question have a valid answer already it is not common that an additional post criticize the first answer, unless of course that the second post fix an error, or present a different solution, or propose any constructive criticism. However your first post does not contain anyone of these cases, but it is a pure negative criticism on my answer. Note that you had not used any affable term (like "I think", "perhaps", "it would", etc) in your post.
I read your first post and, confused, asked you for its purpose, but your reply was "quite clear": another pure and simple criticism to my answer.
If you still don't see my viewpoint, let me do it clearer. Your first two posts above have this meaning for me:
foxidrive's two posts meaning for me wrote:"My interpretation of the task is" different than yours (but I not present the solution I proposed, just personal opinions). "Your solution above" is not what "I assumed the OP wants", so "you'll have to wait for acknowledgement from the OP".
Of course, I get offended because these words...
Perhaps I misunderstood something?