How to monitor tomcat thru VBs and batch and put it over task scheduler

0

I have created script which will monitor tomcat server. If tomcat is running the shoot an email that "tomcat is running" And if not the start the tomcat and send mail that "tomcat is not running . Will be start in few miniute"

here is my code

this batch file which will check tomcat status

@echo off
tasklist /FI "IMAGENAME eq java.exe" | find /C /I ".exe" > NUL
if %errorlevel%==0 goto :running

echo tomcat is not running
wscript "C:\Users\computer\Desktop\bash_testing\mailtest_notrunning.vbs"
start C:\apache-tomcat-7.0.34\apache-tomcat-7.0.34\bin\startup.bat
goto :eof

:running

echo tomcat is running
wscript "C:\Users\computer\Desktop\bash_testing\mailtest_running.vbs"


:eof

Now vb called in above code which is

Set objOutlook = CreateObject("Outlook.Application")
  Set objMail = objOutlook.CreateItem(0)
  objMail.Display   'To display message
  objMail.Recipients.Add ("xyz@mail.com")

  objMail.Subject = "Tomcat Status"
  objMail.Body = "Tomcat is running Properly"

  objMail.Send   

  Set objMail = Nothing
  Set objOutlook = Nothing

My code is running fine.

But when i bind this code with task scheduler . with trigger in every 5min. It display "An instance of the task is already running 0x8004131F"

Can someone help me which instance is running and how to quit that instance so the script can execute in every 5 min

tomcat
batch-file
vbscript
asked on Stack Overflow May 20, 2014 by srn

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0