Mon, 18 Feb 2013 19:47:24 +0100
Fixed check mailq on ssmtp systems
5 | 1 | #!/bin/bash |
2 | # | |
3 | ############################################################################# | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
12
diff
changeset
|
4 | # Copyright (C) 2005-2012 |
5 | 5 | # |
6 | # Michiel Broek <mbse@mbse.dds.nl> | |
7 | # the Netherlands | |
8 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
12
diff
changeset
|
9 | # This file is part of SlackSecCheckScripts. |
5 | 10 | # |
11 | # This package is free software; you can redistribute it and/or modify it | |
12 | # under the terms of the GNU General Public License as published by the | |
13 | # Free Software Foundation; either version 2, or (at your option) any | |
14 | # later version. | |
15 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
12
diff
changeset
|
16 | # SlackSecCheckScripts is distributed in the hope that it will be useful, but |
5 | 17 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | # General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with MBSE BBS; see the file COPYING. If not, write to the Free | |
23 | # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
24 | ############################################################################# | |
25 | ||
26 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
27 | ||
28 | umask 077 | |
29 | TZ=UTC; export TZ | |
30 | LANG=C; export LANG | |
31 | ||
32 | SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1 | |
33 | ||
34 | trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE | |
35 | ||
36 | if ! cd "$SECUREDIR"; then | |
37 | echo "Can not cd to $SECUREDIR". | |
38 | exit 1 | |
39 | fi | |
40 | ||
41 | TMP=$SECUREDIR/tmp | |
42 | ||
43 | if [ -x /usr/sbin/smartctl ] && [ -f /etc/smartd.conf ]; then | |
44 | kill -0 `pidof /usr/sbin/smartd` 2>/dev/null | |
45 | if [ "$?" != "0" ]; then | |
46 | printf "\nWarning: smartd is not running.\n" | |
47 | fi | |
48 | ||
12
3179bc45c83c
Added high disk temp reporting
Michiel Broek <mbroek@mbse.eu>
parents:
5
diff
changeset
|
49 | DISKS=$( egrep '^[^#]*(dev)' /etc/smartd.conf | awk '{ print $1 }' ) |
5 | 50 | for f in $DISKS ; do |
51 | # /usr/sbin/smartctl -H -i -l error -l selftest $f | |
52 | /usr/sbin/smartctl -q errorsonly -H -l error $f > $TMP | |
53 | if [ -s $TMP ]; then | |
54 | printf "\nS.M.A.R.T. error information for disk %s\n\n" $f | |
55 | cat $TMP | |
56 | fi | |
12
3179bc45c83c
Added high disk temp reporting
Michiel Broek <mbroek@mbse.eu>
parents:
5
diff
changeset
|
57 | # Most harddisk manufactures specify 60 degrees Celsius, warn a little below that |
3179bc45c83c
Added high disk temp reporting
Michiel Broek <mbroek@mbse.eu>
parents:
5
diff
changeset
|
58 | TEMP=$( /usr/sbin/smartctl -A $f | grep ^194 | awk '{ print $10 }' ) |
3179bc45c83c
Added high disk temp reporting
Michiel Broek <mbroek@mbse.eu>
parents:
5
diff
changeset
|
59 | if [ ! -z "$TEMP" ] && [ ${TEMP} -ge 53 ]; then |
3179bc45c83c
Added high disk temp reporting
Michiel Broek <mbroek@mbse.eu>
parents:
5
diff
changeset
|
60 | printf "\nS.M.A.R.T. high temperature for disk %s, %s degrees Celsius\n" $f $TEMP |
3179bc45c83c
Added high disk temp reporting
Michiel Broek <mbroek@mbse.eu>
parents:
5
diff
changeset
|
61 | fi |
5 | 62 | done |
63 | fi | |
64 |