Commit 1c53cf58 authored by fwinkler's avatar fwinkler

Fixed bugs in logrotate scripts.

parent d5e46a8d
......@@ -9,17 +9,21 @@ ERROR_COLLECTION_PATH=/sw/taurus/tools/pika/logs/$(date +"%d-%m-%Y")
touch $ERROR_FILE
# grep for various errors in logfile
echo "search for errors in collectd log file:"
grep -m 10 -i "error" $PIKA_COLLECTD_LOGFILE >> $ERROR_FILE
grep -m 1 "uc_update" $PIKA_COLLECTD_LOGFILE >> $ERROR_FILE
if [ -f $PIKA_COLLECTD_LOGFILE ]; then
echo "search for errors in collectd log file:"
grep -m 10 -i "error" $PIKA_COLLECTD_LOGFILE >> $ERROR_FILE
grep -m 1 "uc_update" $PIKA_COLLECTD_LOGFILE >> $ERROR_FILE
fi
# search for error in debug output (only for files not older than 1 day)
files="$(find /tmp/pika_debug/pika_* -mtime -1)"
if [ ! -z "$files" ]; then
echo "search for errors in debug output:"
for file in "$files"
do
grep -i "error " $file >> $ERROR_FILE
done
if [ -d /tmp/pika_debug ]; then
files="$(find /tmp/pika_debug/pika_* -mtime -1)"
if [ ! -z "$files" ]; then
echo "search for errors in debug output:"
for file in "$files"
do
grep -i "error " $file >> $ERROR_FILE
done
fi
fi
#check size of mail file
......
#!/bin/bash
source /sw/taurus/tools/pika/pika-current.conf
# get utility functions
source ${PIKA_ROOT}/pika_utils.sh
ERROR_COLLECTION_PATH=/sw/taurus/tools/pika/logs/$(date +"%d-%m-%Y")
SUBJECT="[PIKA] found errors"
......@@ -15,8 +20,7 @@ ls -1 >> $MESSAGE
# send email if log exists
if [ -d "$ERROR_COLLECTION_PATH" ]; then
mail -S smtp=mailin5.zih.tu-dresden.de -s "$SUBJECT" -r $HOSTNAME@taurus.hrsk.tu-dresden.de frank.winkler@tu-dresden.de < $MESSAGE
mail -S smtp=mailin5.zih.tu-dresden.de -s "$SUBJECT" -r $HOSTNAME@taurus.hrsk.tu-dresden.de robert.dietrich@tu-dresden.de < $MESSAGE
send_email "$SUBJECT" $MESSAGE
fi
rm $MESSAGE
#!/bin/bash
source /sw/taurus/tools/pika/pika.conf
source /sw/taurus/tools/pika/pika-current.conf
# get utility functions
source ${PIKA_ROOT}/pika_utils.sh
HOSTNAME=`echo $(hostname) | cut -d "." -f 1`
MAILTEXT_FILE=${PIKA_LOGPATH}/mailtext_collectd
......@@ -8,13 +11,17 @@ MAILTEXT_FILE=${PIKA_LOGPATH}/mailtext_collectd
touch $MAILTEXT_FILE
# grep for various errors in logfile
cat $PIKA_COLLECTD_LOGFILE | grep -i "error" >> $MAILTEXT_FILE
if [ -f $PIKA_COLLECTD_LOGFILE ]; then
cat $PIKA_COLLECTD_LOGFILE | grep -i "error" >> $MAILTEXT_FILE
fi
# search for error in debug output (only for files not older than 1 day)
files="$(find /tmp/pika_debug/pika_* -mtime -1)"
for file in "$files"
do
grep -i "error " $file >> $MAILTEXT_FILE
done
if [ -d /tmp/pika_debug ]; then
files="$(find /tmp/pika_debug/pika_* -mtime -1)"
for file in "$files"
do
grep -i "error " $file >> $MAILTEXT_FILE
done
fi
#check size of mail file
FILESIZE=$(stat -c%s "$MAILTEXT_FILE")
......@@ -24,8 +31,7 @@ FILESIZE=$(stat -c%s "$MAILTEXT_FILE")
# send email if mail file size is greater than 0
if [[ $FILESIZE -gt 0 ]]
then
mail -S smtp=mailin5.zih.tu-dresden.de -s "[PIKA] collectd errors" -r $HOSTNAME@taurus.hrsk.tu-dresden.de frank.winkler@tu-dresden.de < $MAILTEXT_FILE
mail -S smtp=mailin5.zih.tu-dresden.de -s "[PIKA] collectd errors" -r $HOSTNAME@taurus.hrsk.tu-dresden.de robert.dietrich@tu-dresden.de < $MAILTEXT_FILE
send_email "[PIKA] collectd errors" $MAILTEXT_FILE
fi
rm $MAILTEXT_FILE
......
frank.winkler@tu-dresden.de
#robert.dietrich@tu-dresden.de
robert.dietrich@tu-dresden.de
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment