Skip to content

Instantly share code, notes, and snippets.

@dsturnbull
Created March 18, 2011 10:13
Show Gist options
  • Save dsturnbull/875850 to your computer and use it in GitHub Desktop.
Save dsturnbull/875850 to your computer and use it in GitHub Desktop.
#!/bin/ksh
# Public domain. Use as you wish.
EMAIL=admins@darkstar
TMPFILE=/tmp/fmadm.output.$$
export PATH=/usr/bin:/usr/sbin
#
# run fmadm and cut away the first two lines
#
fmadm faulty >$TMPFILE
#
# check if the file size is greater than zero
# which means we got some output from fmadm and
# therefore some hardware may be bad
#
if [ -s $TMPFILE ]; then
cat $TMPFILE | mailx -s "Hardware failed on `hostname`" $EMAIL
fi
rm -f $TMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment