security.d/chk_smart

changeset 12
3179bc45c83c
parent 5
fe3130d22800
child 14
59e07bba67cc
equal deleted inserted replaced
11:a1f9231336f2 12:3179bc45c83c
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # $Id$
4 #
5 ############################################################################# 3 #############################################################################
6 # Copyright (C) 2005 4 # Copyright (C) 2005-2009
7 # 5 #
8 # Michiel Broek <mbse@mbse.dds.nl> 6 # Michiel Broek <mbse@mbse.dds.nl>
9 # Beekmansbos 10 7 # Beekmansbos 10
10 # 1971 BV IJmuiden 8 # 1971 BV IJmuiden
11 # the Netherlands 9 # the Netherlands
48 kill -0 `pidof /usr/sbin/smartd` 2>/dev/null 46 kill -0 `pidof /usr/sbin/smartd` 2>/dev/null
49 if [ "$?" != "0" ]; then 47 if [ "$?" != "0" ]; then
50 printf "\nWarning: smartd is not running.\n" 48 printf "\nWarning: smartd is not running.\n"
51 fi 49 fi
52 50
53 DISKS=`egrep '^[^#]*(dev)' /etc/smartd.conf | awk '{ print $1 }'` 51 DISKS=$( egrep '^[^#]*(dev)' /etc/smartd.conf | awk '{ print $1 }' )
54 for f in $DISKS ; do 52 for f in $DISKS ; do
55 # /usr/sbin/smartctl -H -i -l error -l selftest $f 53 # /usr/sbin/smartctl -H -i -l error -l selftest $f
56 /usr/sbin/smartctl -q errorsonly -H -l error $f > $TMP 54 /usr/sbin/smartctl -q errorsonly -H -l error $f > $TMP
57 if [ -s $TMP ]; then 55 if [ -s $TMP ]; then
58 printf "\nS.M.A.R.T. error information for disk %s\n\n" $f 56 printf "\nS.M.A.R.T. error information for disk %s\n\n" $f
59 cat $TMP 57 cat $TMP
60 fi 58 fi
59 # Most harddisk manufactures specify 60 degrees Celsius, warn a little below that
60 TEMP=$( /usr/sbin/smartctl -A $f | grep ^194 | awk '{ print $10 }' )
61 if [ ! -z "$TEMP" ] && [ ${TEMP} -ge 53 ]; then
62 printf "\nS.M.A.R.T. high temperature for disk %s, %s degrees Celsius\n" $f $TEMP
63 fi
61 done 64 done
62 fi 65 fi
63 66

mercurial