1 |
trond |
1 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
# $Ximalas$ |
4 |
|
|
|
5 |
|
|
PATH=/bin:/sbin:/usr/bin |
6 |
|
|
|
7 |
|
|
DMESG_BASE=/tmp |
8 |
|
|
DMESG_OLD=${DMESG_BASE}/dmesg.old |
9 |
|
|
DMESG_NEW=${DMESG_BASE}/dmesg.new |
10 |
|
|
DMESG_DIFF=${DMESG_BASE}/dmesg.diff |
11 |
|
|
|
12 |
|
|
DIFF_PARAM="-u" |
13 |
|
|
|
14 |
|
|
RCPT=trond@localhost |
15 |
|
|
|
16 |
|
|
if [ ! -f ${DMESG_OLD} ]; then |
17 |
|
|
dmesg > ${DMESG_OLD}; |
18 |
|
|
fi |
19 |
|
|
|
20 |
|
|
dmesg > ${DMESG_NEW} |
21 |
|
|
|
22 |
|
|
if ! diff ${DIFF_PARAM} ${DMESG_OLD} ${DMESG_NEW} > ${DMESG_DIFF}; then |
23 |
|
|
mail -s "dmesg changed" ${RCPT} < ${DMESG_DIFF}; |
24 |
|
|
mv ${DMESG_NEW} ${DMESG_OLD}; |
25 |
|
|
fi |
26 |
|
|
|
27 |
|
|
exit 0 |