Sponsored Content
Full Discussion: Online log monitoring script
Top Forums Shell Programming and Scripting Online log monitoring script Post 302607666 by hishanms on Thursday 15th of March 2012 04:17:12 AM
Old 03-15-2012
Quote:
Originally Posted by codemaniac
Try to fire mailx only when $Error is not null

Code:
if [[ -z $Error ]]
echo "$Error" |mailx -s "ABC Error" ABCD@domain.lk 
fi

I tried this and it's perfectly working.
Thanks everyone.

Code:
#!/bin/bash  
tail /oracle/app/admin/ABC/bdump/alert_ABC.log >> /tmp/tempoutput 
  
Error=`egrep 'error|warn|critical|fail|ORA-1683' /tmp/tempoutput ` 

echo $Error >/tmp/error 
count=`echo $Error|wc -w`

IP=`/usr/sbin/ifconfig ce0 | grep inet | awk '{print $2}'`

if [ $count -ne 0 ] 
then 
echo "$Error" |mailx -s "ABC Error -($IP) "  ABCD@domain.lk
fi 
 
> /tmp/tempoutput
> /tmp/error

[/QUOTE]

Last edited by hishanms; 03-15-2012 at 05:24 AM..
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Online log

Hi, I have this situation: There is an online.log to which one app is continuously writing. This app is 24*7. This log will fill up our File system pretty quickly. Such that I need to take backups of that file for safekeeping without stopping the App. These backups I can move to another... (5 Replies)
Discussion started by: chaandana
5 Replies

2. Shell Programming and Scripting

help needed - log file monitoring script

hi Gurus, Need to pick your brains on this minor script project. I would like to continuously monitor a log file with sample log messages as below, and if PSOldGen percentage is either 99% or 100% for consecutively 10 times, alert someone. {Heap before gc invocations=46516: PSYoungGen ... (6 Replies)
Discussion started by: kenchen722
6 Replies

3. Shell Programming and Scripting

Log folder size monitoring script

Hi All, Can anyone refer to me a readymade script for the purpose of log folder size monitoring script. Example : I have a log folder of size 10 G, and as the logs keep accumulating the folder gets full and i have to manually zip/remove the files in order to keep the server running. Something... (1 Reply)
Discussion started by: findjai
1 Replies

4. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

5. Shell Programming and Scripting

Monitoring script for a log file

Hi, I need to get a script working to monitor a log file and throw an alert via mailx as soon as a particular error is encountered. I do not want repeatative email notifications of same error so simply cat logfile and grepping the error would not work. Here is what i planned but it seems... (2 Replies)
Discussion started by: roshan.171188
2 Replies

6. UNIX for Beginners Questions & Answers

Monitoring script for Log file

Hi, Iam new to unix , plz help me to write below script. I need to write a script for Monitoring log file when any error occurs it has to send a mail to specified users and it should be always pick latest error not the existing one and the script should be able to send mail all errors (more... (1 Reply)
Discussion started by: vij05
1 Replies

7. UNIX for Beginners Questions & Answers

Shell script for continuously monitoring log file

Hi I have written below log monitoring script to egrep multiple words and redirect the output to a text file and its working fine but I want to add some more below given functionality to it, which is very advance and im not very good in it, so please help if you can :) I am egrepping all the... (1 Reply)
Discussion started by: scazed
1 Replies
CUBRID_ERROR_CODE(3)							 1						      CUBRID_ERROR_CODE(3)

cubrid_error_code - Get error code for the most recent function call

SYNOPSIS
int cubrid_error_code (void ) DESCRIPTION
The cubrid_error_code(3) function is used to get the error code of the error that occurred during the API execution. Usually, it gets the error code when API returns false as its return value. PARAMETERS
This function has no parameters. RETURN VALUES
Error code of the error that occurred, or 0 (zero) if no error occurred. EXAMPLES
Example #1 cubrid_error_code(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb"); $req = cubrid_prepare($conn , "SELECT * FROM code WHERE s_name=?"); $req = @cubrid_execute($req); if (!$req) { printf("Error facility: %d Error code: %d Error msg: %s ", cubrid_error_code_facility(), cubrid_error_code(), cubrid_error_msg()); cubrid_disconnect($conn); exit; } ?> The above example will output: Error facility: 4 Error code: -30015 Error msg: Some parameter not binded SEE ALSO
cubrid_error_code_facility(3), cubrid_error_msg(3). PHP Documentation Group CUBRID_ERROR_CODE(3)
All times are GMT -4. The time now is 12:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy