summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/check_hw.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/contrib/check_hw.sh b/contrib/check_hw.sh
new file mode 100644
index 0000000..f03398e
--- /dev/null
+++ b/contrib/check_hw.sh
@@ -0,0 +1,66 @@
1#! /bin/sh
2#
3# Tested on SuSE 9.1 Professional with the hwinfo-8.62-0.2 package installed.
4#
5# Before you can run this plugin, you must do:
6# /usr/sbin/hwinfo --short > /etc/hw.original
7# add to cron job:
8# /usr/sbin/hwinfo --short > /etc/hw.current
9# /usr/bin/diff /etc/hw.original /etc/hw.current > /tmp/hw.check
10#
11#
12# Rok Debevc -- rok.debevc@agenda.si
13#
14#
15PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
16
17PROGNAME=`basename $0`
18PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
19REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'`
20
21. $PROGPATH/utils.sh
22
23
24print_usage() {
25 echo "Usage: $PROGNAME"
26}
27
28print_help() {
29 print_revision $PROGNAME $REVISION
30 echo ""
31 print_usage
32 echo ""
33 echo "This plugin checks hardware changes."
34 echo ""
35 support
36 exit 0
37}
38
39case "$1" in
40 --help)
41 print_help
42 exit 0
43 ;;
44 -h)
45 print_help
46 exit 0
47 ;;
48 --version)
49 print_revision $PROGNAME $REVISION
50 exit 0
51 ;;
52 -V)
53 print_revision $PROGNAME $REVISION
54 exit 0
55 ;;
56 *)
57 if `du /tmp/hw.check | cut -c 1|grep "^[0]" > /dev/null` ; then
58 echo No hardware is changed
59 exit 0
60 else
61 echo ***hardware is changed*** look into /tmp/hw.check
62 exit 2
63 fi
64 ;;
65esac
66