Categories

Our Sponsors

Windows Scheduled Task Log Output

I needed to have a script list and kill processes and I needed that script to run out of a scheduled task.

It would be nice to know what happened with the script when it runs early in the morning.

I found  that if you call the script from the Windows Task Scheduler that you can give the job a few more options.

Change the scheduled tasks to read as
cmd /C NightlyBatchJob.bat > NightlyBatchJob.output.txt 2>&1

The output should be placed in the same directory as the script.

I also should include the script that stops all of the java processes for Wallstreet systems CMM/TRM application.

REM Win 2003 systems have the sleep command
REM sleep 40
REM XP systems don't.
REM The ping command times out at 20 seconds, goofy way to create a wait.
REM Comment out either the ping or the sleep depending on which works

cd \<install_path>\pmm\bin

REM force PMAD/PMSD to start, in case they are not running
net start "Wallstreet Suite - pmad"
net start "Wallstreet Suite - pmsd"

.\pm_cmd admin_account/password@localhost:8887 stop SDM@test1
.\pm_cmd admin_account/password@localhost:8887 stop ACM@test1
.\pm_cmd admin_account/password@localhost:8887 stop websuite_appserver@test1
.\pm_cmd admin_account/password@localhost:8887 stop WebSuite@test1
.\pm_cmd admin_account/password@localhost:8887 stop cmm_tcmd_appserver@test1

REM sleep 40
ping 10.10.10.254 > NUL
ping 10.10.10.254 > NUL

.\pm_cmd admin_account/password@localhost:8887 stop TRM@test1

ping 10.10.10.254 > NUL
ping 10.10.10.254 > NUL

.\pm_cmd admin_account/password@localhost:8887 stop messaging@test1
.\pm_cmd admin_account/password@localhost:8887 stop active_mq@test1
.\pm_cmd admin_account/password@localhost:8887 stop trm_mdsd@test1
.\pm_cmd admin_account/password@localhost:8887 stop omninames@test1

REM Only stop  pmad/pmsd if really necessary
REM net stop "Wallstreet Suite - pmsd"
REM net stop "Wallstreet Suite - pmad"

REM sleep 20
ping 10.10.10.254 > NUL

REM Display processes status if needed
.\pm_cmd admin_account/password@localhost:8887 proc

REM sleep 40
ping 10.10.10.254 > NUL
ping 10.10.10.254 > NUL

REM Make sure everything is down by killing any hung processes.
.\pm_cmd admin_account/password@localhost:8887 kill WALLSTREET_SUITE@test1

REM sleep 40
ping 10.10.10.254 > NUL
ping 10.10.10.254 > NUL
REM List out the remaining running tasks owned by SYSTEM
tasklist /S localhost /U SYSTEM
REM Kill any left over java processes. NOTE: will kill ALL JAVA processes on the system
taskkill /F /FI "IMAGENAME eq java*"

  • Share/Bookmark

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes