help with email to be triggered based on fatal error detection from batch run log file neded


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help with email to be triggered based on fatal error detection from batch run log file neded
# 1  
Old 09-06-2011
Java help with email to be triggered based on fatal error detection from batch run log file neded

Hi,

I require need help in two aspects actually:

1) Fatal error that gets generated as %F% from a log file say ABClog.dat to trigger a mail. At present I manually grep the log file as <grep %F% ABClog.dat| cut-d "%" -f1>. The idea is to use this same logic to grep the log file which is present in $ABC_log directory.

2) How to create a mail that can be triggered. As far as I know the mailing abilities are enabled.

I use PUTTY to access the unix environment (maintained in solaris), and use a generalized login username (eg: f00_mgr). If the script can be run from $HOME to get the fatal error's and mail it would be great. I am kind of very new to the scripting in Unix so any help in sample codes or even the whole would be highly appreciated.

Thanks in advance

Regards
Abhradip Choudhuri

Last edited by zico1986; 09-06-2011 at 02:23 PM..
# 2  
Old 09-06-2011
You can try this:
Code:
#!/usr/bin/ksh
mRC=$(grep -c '%F%' ABClog.dat)
if [[ "${mRC}" != "0" ]]; then
  <send your mail here>
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

PHP Fatal Errors During SSL Cert Management - PHP Fatal error: xc_fcntl_mutex failed

Today, I noticed some errors in our SSL cert renewal log files, mostly related to domains where the IP address had changed. Concerned about this, rebuilt out SSL cert, which normally goes well without a hiccup. However, for today, for some reason which I cannot explain, there was a PHP error... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Email need to be triggered

hi, Currently, in my code, the errors are written in log file. Additionally, i need to trigger the email of error captured. can we modify this script with email triggered along with existing command. echo "ERROR: $SCRIPT: $*" >>$LOGFILE (1 Reply)
Discussion started by: gowthamsoft
1 Replies

3. Shell Programming and Scripting

To run a shell script in remote server from windows batch file

Hi all, i need to run a shell script on remote server. I have created file .bat file in windows server with following code, c:\Users\Desktop\putty.exe -ssh -pw password user@server ./script.sh i need to run the script.sh in my remote server Above command is not working, any... (4 Replies)
Discussion started by: rammm
4 Replies

4. Shell Programming and Scripting

How to run a script using batch file?

the manual process which we follow is login to remote unix box thro putty using the unix account and password and then sudo to root user. server name:abc@server.com login as:pqrst password:****** $ sudo su - root then run the script stored on remote server under root account. ... (9 Replies)
Discussion started by: gpk_newbie
9 Replies

5. UNIX for Dummies Questions & Answers

send an email from batch file

My batch files run every day, it moves files from servers to my local computer, can I have a confirmation email sent to me from this batch file saying if the job failed or successes? Thank you for your help! (6 Replies)
Discussion started by: idiazza
6 Replies

6. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

7. Shell Programming and Scripting

File detection then run script

I am currently running 4 scripts to complete a job for me. Each script requires the finished file of the one before it. For example the first script gets the finished file called model.x, then i would like script2 to start in and use model.x as the input and get model_min.x as the finished... (5 Replies)
Discussion started by: olifu02
5 Replies

8. Shell Programming and Scripting

Run a script based on the subject line of the email

Hi, I need help in running a script that would pull info from an email subject line and run a script (foo.sh). I'm pretty sure after a bit of googling that this is possible in several ways. but none was pretty clear on how to accomplish it. The part that I really need help with is getting the... (5 Replies)
Discussion started by: satekn
5 Replies

9. UNIX for Dummies Questions & Answers

How to create an run a simple batch file?

Hi, So, I created a file named TEST.BAT in my home directory. In it, I wrote: #! /bin/bash echo Hello and then, saved the file. Then, at the command-line interface, I typed TEST.BAT, but the command-line never executes the file and thus, never returns "Hello". It says "command... (2 Replies)
Discussion started by: Hyunkel
2 Replies

10. UNIX for Dummies Questions & Answers

How can I run scripts in my unix account from batch file in Windows?

Hi all, I'm working on Windows, connecting to my Unix account by different ways: by FTP opening files in UltraEdit32, by mapping drive to browse, by Exceed or Telnet to compile at Unix account. Actually, that is what I would like to change: I'd like to make a batch file which would connect to... (7 Replies)
Discussion started by: olgafb
7 Replies
Login or Register to Ask a Question