#!/bin/sh # name: checkmessages # # The checkmessages script check the logs. If anything wrong is found, the script # sends email to the system administrator. # # This script should be scheduled to run daily using cron. # # Read associated tech tip at: # http://www.sun.com/bigadmin/content/submitted/system_autocheck.jsp # # The messages to be ignored FILTER="| grep -v \"forceload of misc/md_trans failed\"" FILTER="$FILTER | grep -v \"No proxy found\"" MAIL_RECEIVER= PATH=/usr/bin; export PATH # check today's messages above the level of warning GREP="grep \"^`date|cut -c5-10`\" /var/adm/messages | egrep \"emerg|alert|crit|err|warning\"" GREP="$GREP$FILTER" if eval "$GREP" > /tmp/seriousmessages.txt then mailx -s " Serious Message" $MAIL_RECEIVER < /tmp/seriousmessages.txt fi ############################################################################## ### This script is submitted to BigAdmin by a user of the BigAdmin community. ### Sun Microsystems, Inc. is not responsible for the ### contents or the code enclosed. ### ### ### Copyright Sun Microsystems, Inc. ALL RIGHTS RESERVED ### Use of this software is authorized pursuant to the ### terms of the license found at ### http://www.sun.com/bigadmin/common/berkeley_license.jsp ##############################################################################