Sponsored Content
Top Forums Shell Programming and Scripting Capture all error message in Log file and send the Log file by email Post 302518642 by dgmm on Saturday 30th of April 2011 09:30:54 PM
Old 04-30-2011
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 message to Logfile.
I check $? !=0 then I write "**ERROR** happened in this task" to Log file.

At the end of the script I do
Quote:
Error_Count=`grep **ERROR** Logfile | wc -l`
But I get Null in $Error_Count. So I am not able determine how to know if there are any ERROR.
But when I open the Logfile after the script finishes I see **ERROR** present in Logfile. Can anyone suggest me how to capture all error message and send in Logfile.

Thanks and Regards
Digambar
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sh Prgram to capture Log message.

Hi All, I have a log file which consists of log messages as follows -> GLOBALCALLID_CLUSTERID_B NEXT * , O(") CHARACTER JOINONBEHALFOF NEXT * , O(") CHARACTER Record 1: Rejected - Error on table IFA_MMV_CDR, column CDRRECORDTYPE.... (1 Reply)
Discussion started by: rahulrathod
1 Replies

2. Shell Programming and Scripting

capture nohup log file

Hi, I am running my script using nohup, but I am not able to capture the log file for that process could naybody please help... Here is what I am doing.... nohup ./script & 1>/home/user1/log.txt but I am not able to capture the log.....Is there anyother way I can capture the log... (2 Replies)
Discussion started by: mgirinath
2 Replies

3. Shell Programming and Scripting

Fishing out error message within a log file

Hi all, i have a log file that captures success or failure messges when i run a daily job. here is a sample of my log. 20060312 start successful successful failure failure 20060312 end i need to write a subroutine that opens up the log daily after my job completes to examine the log... (2 Replies)
Discussion started by: new2ss
2 Replies

4. Shell Programming and Scripting

error-when trying to send the message thru email.

Hi All, I want to send a message through email. I have written below code. But it is not worling. Anybody has idea, why it is not working?. export $file1=$home1/pip1.$$ mailx -s "This Message from unix" abc@yahoo.com< $file1 thanks,Mary. (5 Replies)
Discussion started by: MARY76
5 Replies

5. Shell Programming and Scripting

how to send contents of a file to email as a message

i have a file new1.txt i want to send the contents of that file as a message to email ali@sms.com i m using ksh script......... plz help me (5 Replies)
Discussion started by: ali560045
5 Replies

6. Shell Programming and Scripting

Send-file /var/log/message

Hello All i need Shell Script to send /var/log/message or another if he have or grep this file to have some info like PID or value (e.g like NFS mount - stop ) to some body in my System Thanks for Advanced (2 Replies)
Discussion started by: Hosam
2 Replies

7. Shell Programming and Scripting

How to capture output to log file

Hi I have a script that will run multiple unix & sql commands. I want to see the output as well as capture it to a log file for further analysis. Is there an easy way to do that instead of adding "tee -a logfile" on everyline or even on the execute line (i.e. script | tee -s logfile). Thanks (1 Reply)
Discussion started by: nimo
1 Replies

8. Shell Programming and Scripting

format log file and send in email.

Hi guys i have one script which is as below do some sqlplus output in to $LOG sed '/^$/d' $LOG > /tmp/job.log mv /tmp/job.log $LOG awk '{if ($5=="COMPLETED") {print "backup completed at "$3" "$4 " of " $6 " for " d>> "/home/email.log" } else {print "check backup for " d}}' d="$ORACLE_SID"... (2 Replies)
Discussion started by: tapia
2 Replies

9. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: zico1986
1 Replies

10. Shell Programming and Scripting

Send an email if "No such file or directory" in the shell script program log in EBS concur

Hi All, I have the below code(.sh) and need to send an email. #!/bin/bash cp /u02/xxc_incoming/TEST*.dat /u02/xxc_archive_incoming/AMER7764_ARPP_2/ cat /u02/xxc_incoming/TEST*.dat > /u02/xxc_incoming/XXC_TEST.dat rm /u02/xxc_incoming/TEST*.dat cd $XXC_TOP/bin sqlldr userid=apps/<pwd> ... (12 Replies)
Discussion started by: Mist123
12 Replies
Git::Repository::Log(3pm)				User Contributed Perl Documentation				 Git::Repository::Log(3pm)

NAME
Git::Repository::Log - Class representing git log data SYNOPSIS
# load the Log plugin use Git::Repository 'Log'; # get the log for last commit my ($log) = Git::Repository->log( '-1' ); # get the author's email print my $email = $log->author_email; DESCRIPTION
"Git::Repository::Log" is a class whose instances reprensent log items from a git log stream. CONSTRUCTOR
This method shouldn't be used directly. "Git::Repository::Log::Iterator" should be the preferred way to create "Git::Repository::Log" objects. new( @args ) Create a new "Git::Repository::Log" instance, using the list of key/values passed as parameters. The supported keys are (from the output of "git log --pretty=raw"): commit The commit id (ignore the extra information added by --decorate). tree The tree id. parent The parent list, separated by spaces. author The author information. committer The committer information. message The log message (including the 4-space indent normally output by git log). extra Any extra text that might be added by extra options passed to git log. ACCESSORS
The following accessors methods are recognized. They all return scalars, except for "parent()", which returns a list. Commit information commit tree parent Author and committer information author committer The original author/committer line author_name committer_name author_email committer_email Date information author_gmtime committer_gmtime author_localtime committer_localtime author_tz committer_tz Log information raw_message The log message with the 4-space indent output by git log. message The unindented version of the log message. subject body Extra information extra AUTHOR
Philippe Bruhat (BooK), "<book at cpan.org>" COPYRIGHT
Copyright 2010 Philippe Bruhat (BooK), all rights reserved. LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-12-28 Git::Repository::Log(3pm)
All times are GMT -4. The time now is 08:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy