pika_mail_error_info.sh 766 Bytes
Newer Older
fwinkler's avatar
fwinkler committed
1 2 3 4 5
#!/bin/bash

ERROR_COLLECTION_PATH=/sw/taurus/tools/pika/logs/$(date +"%d-%m-%Y")
SUBJECT="[PIKA] found erros"

fwinkler's avatar
fwinkler committed
6 7 8 9 10 11 12 13 14 15 16
MESSAGE=/tmp/pika_email_message
touch $MESSAGE
echo "Errors per node are listed in ${ERROR_COLLECTION_PATH}." >> $MESSAGE
echo "" >> $MESSAGE
cd $ERROR_COLLECTION_PATH
ERROR_COUNT=$(ls | wc -l)
echo "Number of nodes containing errors: ${ERROR_COUNT}" >> $MESSAGE
echo "" >> $MESSAGE
ls -1 >> $MESSAGE

# send if email log exists
fwinkler's avatar
fwinkler committed
17
if [ -d "$ERROR_COLLECTION_PATH" ]; then
fwinkler's avatar
fwinkler committed
18 19 20 21 22
  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
fi

rm $MESSAGE