terminating a batch file after 10 minutes
Discussion
I have a batchfile.... schedule.bat
@echo off
setlocal
REM This batch file runs the IBCom Scheduler Process.
REM It assumes it is being run from the directory in which it resides and that
REM the environment variable JAVA_HOME is defined.
if 1%JAVA_HOME% == 1 goto NO_JAVA_HOME
set _LIBJARS=
for %%i in (lib\*.jar) do call helper\cpappend.bat %%i
%JAVA_HOME%/bin/java -cp ".;./properties;%_LIBJARS%" -Dlog4j.configuration=./properties/Scheduler.properties com.hsbcib.securities.ibcomapps.schedule.Scheduler %1 %2 %3
goto END
:NO_JAVA_HOME
echo Environment variable JAVA_HOME is not set; should be something like C:\tools\jdk1.3.1
goto END
:END
endlocal
problem being it calls a jar file that I cant access.... at the above will run indefinately.
I tried a schedule task that starts up and was supposed to terminate after 10mins and then 20mins later do the process agin.
That didn't work..... All it did was keep opening multiple copies of the above bat file.
I need to find a way for a scheduled task to start the above bat file, let it run for 10mins, kill the bat file and then do the whole process again 20 mins later... any ideas?
Cheers in advance.
Si
@echo off
setlocal
REM This batch file runs the IBCom Scheduler Process.
REM It assumes it is being run from the directory in which it resides and that
REM the environment variable JAVA_HOME is defined.
if 1%JAVA_HOME% == 1 goto NO_JAVA_HOME
set _LIBJARS=
for %%i in (lib\*.jar) do call helper\cpappend.bat %%i
%JAVA_HOME%/bin/java -cp ".;./properties;%_LIBJARS%" -Dlog4j.configuration=./properties/Scheduler.properties com.hsbcib.securities.ibcomapps.schedule.Scheduler %1 %2 %3
goto END
:NO_JAVA_HOME
echo Environment variable JAVA_HOME is not set; should be something like C:\tools\jdk1.3.1
goto END
:END
endlocal
==========
problem being it calls a jar file that I cant access.... at the above will run indefinately.
I tried a schedule task that starts up and was supposed to terminate after 10mins and then 20mins later do the process agin.
That didn't work..... All it did was keep opening multiple copies of the above bat file.
I need to find a way for a scheduled task to start the above bat file, let it run for 10mins, kill the bat file and then do the whole process again 20 mins later... any ideas?
Cheers in advance.
Si
I've used pskill.exe (from the windows resource kit) to effect this kind of thing.
http://www.microsoft.com/technet/sysinternals/util...
schedule pskill to kill the schedule.bat every 10 mins and schedule schedule.bat whenever you like to restart.
klunky bit it should work
http://www.microsoft.com/technet/sysinternals/util...
schedule pskill to kill the schedule.bat every 10 mins and schedule schedule.bat whenever you like to restart.
klunky bit it should work
Should tell you all you need to know 
http://malektips.com/xp_dos_0002.html
You can download the tools to get the sleep command or use the old ping timer trick.
As for it not terminating, can you include some errorlevel processing to decide if the command ran successfully and fall gracefully out the bottom?

http://malektips.com/xp_dos_0002.html
You can download the tools to get the sleep command or use the old ping timer trick.
As for it not terminating, can you include some errorlevel processing to decide if the command ran successfully and fall gracefully out the bottom?
FunkyGibbon said:
I've used pskill.exe (from the windows resource kit) to effect this kind of thing.
http://www.microsoft.com/technet/sysinternals/util...
schedule pskill to kill the schedule.bat every 10 mins and schedule schedule.bat whenever you like to restart.
klunky bit it should work
Is that on the Windows Server 2003?http://www.microsoft.com/technet/sysinternals/util...
schedule pskill to kill the schedule.bat every 10 mins and schedule schedule.bat whenever you like to restart.
klunky bit it should work
Got a quick exmaple of its use?
Edited by ProPlus on Tuesday 3rd July 15:57
The Griffalo said:
Should tell you all you need to know 
http://malektips.com/xp_dos_0002.html
You can download the tools to get the sleep command or use the old ping timer trick.
As for it not terminating, can you include some errorlevel processing to decide if the command ran successfully and fall gracefully out the bottom?
Problem is the Java call in the batch file, meaning as soon as it hits that, it aint ever coming out till an external influence shuts down the scheduler.bat
http://malektips.com/xp_dos_0002.html
You can download the tools to get the sleep command or use the old ping timer trick.
As for it not terminating, can you include some errorlevel processing to decide if the command ran successfully and fall gracefully out the bottom?
Hence the need to kill somehow after 10 mins
ProPlus said:
FunkyGibbon said:
I've used pskill.exe (from the windows resource kit) to effect this kind of thing.
http://www.microsoft.com/technet/sysinternals/util...
schedule pskill to kill the schedule.bat every 10 mins and schedule schedule.bat whenever you like to restart.
klunky bit it should work
Is that on the Windows Server 2003?http://www.microsoft.com/technet/sysinternals/util...
schedule pskill to kill the schedule.bat every 10 mins and schedule schedule.bat whenever you like to restart.
klunky bit it should work
Got a quick exmaple of its use?
Edited by ProPlus on Tuesday 3rd July 15:57
basically:
pskill.exe processname
where processname is the name of the java app running (probably just java.exe) but check in task manager as to what processes run when you start your schedule.bat file and then use pskill to nuke them
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


