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