Configure automatic script in windows server

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Configure automatic script in windows server
# 29  
Old 04-04-2012
Thanks Alot. The above code is worked successfully.

I need small help my oracle.exe process is still running after the database is down.
So,I need to make some changes in code like. Its check the log file search the context "shutdown" from the latest few lines of log file (
Code:
D:\oracle\admin\sid\bdump\alert.log

). if found send email...

Please Please help me into this,
Mohammed Fareed
# 30  
Old 04-07-2012
Dear Expert,

Can you please update me the above needs.

Thank you,
Mohammed Fareed
# 31  
Old 04-09-2012
did u search google for "read the file using vbscript" ?

some more basics and good page for vbscript.
Microsoft Windows 2000 Scripting Guide - VBScript Reference
# 32  
Old 04-10-2012
Thanks alot for your help and affords, At last the script is ment successfully.

If database shutdown in windows database send email with the help of the below scripts (reading last five lines of alert logfile If found "shutdown" contents send email)

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") Then
 'Trigger the email - use blat or bmail utility
 Set WshShell = WScript.CreateObject("WScript.Shell")
 WshShell.Run "C:\\blat182_b\\mailsend -d oracle.com -smtp 192.xx.xx.xx -t fareed@xxx.com -c fareed@xxxx.com -f oracle@server.ae -sub ""Critical Alert  Database not running"" -m message.txt", 1, True
 'clear out wshshell variable
 set wshShell = Nothing
END IF
WScript.Quit

Mohammed Fareed
# 33  
Old 04-10-2012
Good to know that, it is working fine.

please remove the original email address from the post.
This User Gave Thanks to itkamaraj For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

How to connect Linux server (configure two way authentication) with Windows server?

Hi my name is Manju. ->I have configure the two way authentication on my linux server. ->Now I am able to apply two way authenticator on particuler user. ->Now I want to map this linux server to my AD server. ->Kindly tell me how to map AD(Active Directory) with this linux server. ... (0 Replies)
Discussion started by: manjusharma128
0 Replies

2. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

3. Ubuntu

Automatic update script issue (Ubuntu server)

Hi, I've created a very basic script to run apt-get update and apt-get dist-upgrade unattended (run with cron) and save the logs. Though, it's not really a script, just a file containing the commands to run in order: pasteit .com/18601 I'm currently testing this and ran into some unexpected... (4 Replies)
Discussion started by: Raxje
4 Replies

4. Programming

Problem with Perl script after moving from a Windows/Apache Server to a UNIX server.

I have a Perl script that worked fine before moving it to justhost.com. It was on a Windows/Apache server. Just host is using UNIX. Other Perl scripts on other sites that were also moved work fine so I know Perl is functioning. The script is called cwrmail.pl and is located in my cgi-bin. When I... (9 Replies)
Discussion started by: BigBobbyB
9 Replies

5. Shell Programming and Scripting

Unix shell script to Copy files from one Windows server to another Windows server.

Can anybody please help me on how to code for the below requirement: I need to write a shell script (on different unix server) to copy files from multiple folders (ex. BRN-000001) from one windows server (\\boldls-mwe-dev4)to a different windows server(\\rrwin-ewhd04.ecomad.int). This shell... (4 Replies)
Discussion started by: SravsJaya
4 Replies

6. AIX

Do I need to configure my local windows to FTP files from local windows to a UNIX AIX server?

Hi Friends, I have this script for ftping files from AIX server to local windows xp. #!/bin/sh HOST='localsystem.net' USER='myid_onlocal' PASSWD='mypwd_onlocal' FILE='file.txt' ##This is a file on server(AIX) ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE... (1 Reply)
Discussion started by: rajsharma
1 Replies

7. Linux

How to configure linux to receive snmp traps from a windows server?

Can anybody please tell me how to configure linux to receive snmp traps from a windows server? I am not able to receieve snmp traps on unix machines specifically linux and solaris. I have tried starting snmptrapd service on linux but it didn't work. Is there anything special that I have to do on... (2 Replies)
Discussion started by: iamtulipin
2 Replies

8. UNIX for Dummies Questions & Answers

Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server

I have a .sh script which was running fine on all the UNIX Servers (AIX, SunSolaris). The script requires two mandatory parameters and many optional parameters. Now at a different client place who are on a Windows Server, when I try to execute the script through MKS Toolkit, there are couple of... (5 Replies)
Discussion started by: madhunk
5 Replies

9. Solaris

Script for automatic deletion of trash file of mail server

Hi, I have a mail server with limited space and operating system is sun solaris 8 (sparc). I do not have provisions to increase the space for home directory. So i have to delete files from /home/username/mail/trash which are more than 10 days old automatically. So my script should be like... (1 Reply)
Discussion started by: crown2100bd
1 Replies

10. Shell Programming and Scripting

Automatic FTP Script from windows to unix machine

Hi i need to FTP files from windows to unix(sun) machine using script. what are the scripts commands i need to use to transfer files Thanks (2 Replies)
Discussion started by: bmkreddy
2 Replies
Login or Register to Ask a Question