#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/smartmon-mail - warning script for smartmon # # Creation: 09.04.2004 jb # Last Update: $Id$ # # Copyright (c) 2004-2008 Jens Berger # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- . /etc/config.d/base mdstat=/proc/mdstat tmpfile=/var/smartmon/error-$$ cat > $tmpfile ( echo "From: S.M.A.R.T. Daemon " echo "To: $SMARTD_ADDRESS" echo "Subject: $SMARTD_SUBJECT" cat $tmpfile dev=`echo $SMARTD_DEVICE | sed 's/\/dev\///'` md=`cat $mdstat 2>/dev/null | grep -E "[[:space:]]$dev" | grep -E '^md[0-9]+ :' | awk '{print $1}'` echo "-------------------------------------------------------" echo "The following partitions are affected:" echo -n "Device $SMARTD_DEVICE" if [ "$md" != "" ]; then echo " is part of following software-raid(s) " for i in $md; do mp="`mount | grep -E "^/dev/$i[[:space:]]" | awk '{print $3}'`" echo " - /dev/$i mounted on $mp" done else echo ":" for i in `mount | grep -E "^$SMARTD_DEVICE[0-9]+" | awk '{ print $1}' | sort -u`; do echo -n " - $i" echo "`mount | grep "^$i" | awk '{print " mounted on "$3}'`" done fi echo "-------------------------------------------------------" echo "" echo "The EIS/FAIR S.M.A.R.T. Daemon" ) | /usr/lib/sendmail $SMARTD_ADDRESS rm -f $tmpfile