~launchpad-committers/ubuntu/lucid/slony1/ppa-8.4

« back to all changes in this revision

Viewing changes to tools/search-logs.sh

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2008-11-01 14:28:08 UTC
  • mfrom: (1.1.8 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20081101142808-lqwrc03c9udlzdjf
Tags: 1.2.15-1
* New upstream release
* Replaced build dependency gs-gpl by ghostscript again
* Updated standards version
* Changed to debhelper level 7
* Added libdbd-pg-perl to Recommends (closes: #499548)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh 
2
 
# $Id: search-logs.sh,v 1.1.2.2 2006-11-16 20:02:14 cbbrowne Exp $ 
 
2
# $Id: search-logs.sh,v 1.1.2.3 2008-09-12 16:09:23 cbbrowne Exp $ 
3
3
 
4
4
# Search logs for errors from the last hour 
5
5
LOGHOME=${LOGHOME:-"/opt/logs"}    # Directory to search
10
10
# EXCLUSIONS='duplicate key violates unique constraint "sl_nodelock-pkey"'
11
11
EXCLUSIONS="No Exclusions Known"
12
12
 
13
 
if [[ -z $LOGTIMESTAMP ]] ; then
 
13
if [ -z $LOGTIMESTAMP ] ; then
14
14
    HRRE=`date -d "1 hour ago" +"%Y-%m-%d %H:[0-9][0-9]:[0-9][0-9] ${TZ}"`
15
15
else
16
16
    HRRE="${LOGTIMESTAMP}:[0-9][0-9]:[0-9][0-9] ${TZ}"
19
19
for log in `find ${LOGHOME} -name "*.log*" -mmin -60 | egrep "/node[0-9]+/[^/]+.log"` ; do 
20
20
    egrep "${HRRE} (ERROR|FATAL)" $log | egrep -v "${EXCLUSIONS}" > /tmp/slony-errors.$$ 
21
21
 
22
 
    if [[ -s /tmp/slony-errors.$$ ]] ; then 
 
22
    if [ -s /tmp/slony-errors.$$ ] ; then 
23
23
        echo "
24
24
Errors in log ${log} 
25
25
===============================================================" >> /tmp/slony-summary.$$ 
27
27
    fi 
28
28
done 
29
29
 
30
 
if [[ -s /tmp/slony-summary.$$ ]] ; then 
31
 
    if [[ -z $LOGRECIPIENT ]] ; then
 
30
if [ -s /tmp/slony-summary.$$ ] ; then 
 
31
    if [ -z $LOGRECIPIENT ] ; then
32
32
        echo "Errors found!"
33
33
        cat /tmp/slony-summary.$$  
34
34
    else