Unix/Linux Go Back    


Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

Schedule script is not executing some times

Windows & DOS: Issues & Discussions


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-21-2012
Mohammed Fareed Mohammed Fareed is offline
Users Awaiting Email Confirmation
 
Join Date: Mar 2012
Last Activity: 13 March 2014, 9:59 AM EDT
Posts: 57
Thanks: 6
Thanked 0 Times in 0 Posts
Schedule script is not executing some times

Dear Experts,

Once again i need your vital help to fix my issue, please do the needfull.

Issue:- I have schedule one script on windows server to run's every 10 min.(Script do check the alert log file,if database found down it send the email) While i'm doing the database down manually its sending email,
But when its automatically down (By some issue) its not sending the email, I beleive some thing worng in my schedule task, schedule screen shot attached pls help.

Thanks in Advance.
Attached Images
File Type: bmp schedule_task.bmp (960.1 KB, 3 views)
Sponsored Links
    #2  
Old Unix and Linux 05-21-2012
itkamaraj's Unix or Linux Image
itkamaraj itkamaraj is offline Forum Advisor  
Registered User
 
Join Date: Apr 2010
Last Activity: 14 September 2017, 8:59 PM EDT
Posts: 3,148
Thanks: 45
Thanked 698 Times in 674 Posts
where is your script and what pattern you are checking in the logs ?

Is the same log pattern or error is coming in logs (when you manually shutdown and it crashes ? )
Sponsored Links
    #3  
Old Unix and Linux 05-21-2012
Mohammed Fareed Mohammed Fareed is offline
Users Awaiting Email Confirmation
 
Join Date: Mar 2012
Last Activity: 13 March 2014, 9:59 AM EDT
Posts: 57
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks for helping me again Kamaraj, whenever database shutdown or crashes, we have massage in alertlog like "shutdown" and script look for this last fewlines if it is matches send the email. hope you understood my senario.
    #4  
Old Unix and Linux 05-21-2012
itkamaraj's Unix or Linux Image
itkamaraj itkamaraj is offline Forum Advisor  
Registered User
 
Join Date: Apr 2010
Last Activity: 14 September 2017, 8:59 PM EDT
Posts: 3,148
Thanks: 45
Thanked 698 Times in 674 Posts
script look for this last fewlines -- if the shutdown pattern is not in the last few lines ( eventhough the DB is crashed ? )

howmany lines you are checking ?
Sponsored Links
    #5  
Old Unix and Linux 05-21-2012
Mohammed Fareed Mohammed Fareed is offline
Users Awaiting Email Confirmation
 
Join Date: Mar 2012
Last Activity: 13 March 2014, 9:59 AM EDT
Posts: 57
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks for update, i checked in alert log if the database crash its dazen appear the "shutdown" word, Hence I need to add in code extra word "terminated instance".

Can you please help me into this how do i add the extra text in my code?
bold in existing code.


Code:
 
dim WshShell
dim f,fso,Filename
Dim arrFileLines() 
Const ForReading = 1
i = 0 
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFile = FSO.OpenTextFile("C:\\blat182_b\alert.log", 1) 
' create the output file here 
Set objoutputFile = FSO.CreateTextFile("C:\\blat182_b\result_new.txt") 
Do Until objFile.AtEndOfStream 
Redim Preserve arrFileLines(i) 
arrFileLines(i) = objFile.ReadLine 
i = i + 1 
Loop 
objFile.Close 
For l = Ubound(arrFileLines)-5 to Ubound(arrFileLines) 
' write the output to the file 
objoutputFile.writeline arrFileLines(l) 
Next 
'Close the output file 
objoutputFile.close 
Filename = "C:\\blat182_b\result_new.txt"
Set f = fso.OpenTextFile(FileName, ForReading, True)
FileText = f.ReadAll
f.close
IF InStr(FileText,"shutdown", "Instance terminated") Then
 'Trigger the email - use blat or bmail utility
 Set WshShell = WScript.CreateObject("WScript.Shell")
 WshShell.Run "C:\\blat182_b\\mailsend -d xxxx.local -smtp xxx.xxx.xxx.xxx -t xxxx@xx.com, -c xxxx@xx.com  -f xx@xxx-xx.xx -sub ""Critical Alert  Database not running"" -m message.txt", 1, True
 'clear out wshshell variable
 set wshShell = Nothing
END IF
WScript.Quit


Last edited by Scrutinizer; 05-21-2012 at 05:37 AM.. Reason: code tags instead of quote tags, removed email tags because of that...
Sponsored Links
    #6  
Old Unix and Linux 05-21-2012
itkamaraj's Unix or Linux Image
itkamaraj itkamaraj is offline Forum Advisor  
Registered User
 
Join Date: Apr 2010
Last Activity: 14 September 2017, 8:59 PM EDT
Posts: 3,148
Thanks: 45
Thanked 698 Times in 674 Posts

Code:
IF InStr(FileText,"shutdown") or Instr(FileText,"shutdown") Then

Sponsored Links
    #7  
Old Unix and Linux 05-21-2012
Mohammed Fareed Mohammed Fareed is offline
Users Awaiting Email Confirmation
 
Join Date: Mar 2012
Last Activity: 13 March 2014, 9:59 AM EDT
Posts: 57
Thanks: 6
Thanked 0 Times in 0 Posts
I want to check two clause one is
PHP Code:
shutdown 
and another is
PHP Code:
terminated instace
in my above code its not working...
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cron to schedule job at different times apjneeraj Shell Programming and Scripting 2 05-24-2011 08:08 AM
Best way to schedule script to run Ubuntu 10.04 glev2005 UNIX for Dummies Questions & Answers 1 02-04-2011 12:42 PM
Schedule a script to run at 10am from mon to fri firestar Shell Programming and Scripting 7 01-21-2011 12:24 PM
How to schedule my script without crontab prashant43 Shell Programming and Scripting 3 06-08-2009 11:49 AM
Script Schedule Scrutiny geralex2 Shell Programming and Scripting 2 08-29-2006 03:52 AM



All times are GMT -4. The time now is 05:24 PM.