Commit aba5e9af authored by fwinkler's avatar fwinkler

Added new script for logging.

parent ca0dfdf3
#!/bin/bash
source /sw/taurus/tools/pika/pika.conf
HOSTNAME=`echo $(hostname) | cut -d "." -f 1`
ERROR_FILE=${PIKA_LOGPATH}/$HOSTNAME
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:"
cat $COLLECTD_LOGFILE | grep -i "error" >> $ERROR_FILE
# 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
fi
#check size of mail file
FILESIZE=$(stat -c%s "$ERROR_FILE")
#echo "size: $FILESIZE"
# copy file if size is greater than 0
if [ $FILESIZE -gt 0 ]; then
mkdir -p ${ERROR_COLLECTION_PATH}
cp $ERROR_FILE ${ERROR_COLLECTION_PATH}
fi
rm $ERROR_FILE
#!/bin/bash
ERROR_COLLECTION_PATH=/sw/taurus/tools/pika/logs/$(date +"%d-%m-%Y")
SUBJECT="[PIKA] found erros"
# send email 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 <<< $ERROR_COLLECTION_PATH
mail -S smtp=mailin5.zih.tu-dresden.de -s "$SUBJECT" -r $HOSTNAME@taurus.hrsk.tu-dresden.de robert.dietrich@tu-dresden.de <<< $ERROR_COLLECTION_PATH
fi
\ No newline at end of file
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