HI,
I think somebody is looking for a bit of prophecy here
Normally you know on any HW issues developing only when periodically checking the errpt.
I wrote some script that looks for FAN,MIRROR disk and PS problems and informs the customer with a yellow screen once an hour .
You can add an email message with the warning message sent to one of your engineers mobile number.
Here is the script.
===================================
#!/bin/ksh
#
# --------------------------------------------------------------------------------
# Written by: Lev Weissman
# Version 2.0
# Date: July 16, 2002
#
# Function: Checks for FAN, SYSTEM DISK,PS failures in 6F1
# Displays a warning in a new aixterm every hour, and sends mail to “backup” user.
# Once activated the first time – the script programs the cron to run this script every hour.
# ----------------------------------------------------------------------------------
TITLE="FAILURE"
BG=Yellow
CR=Yellow # Make cursor same color as BG so it's invisible
FG=Red # Text Color
ROWS=100
FAILURE=0
STRING="FAILURE !!!"
STRINGDISK=""
STRINGPS=""
STRINGFAN=""
STRINGCALL="Please call Creo support !"
###### main ######
#add crontab entry
crontab –l |grep “check-redundancy.sh” > /dev/null
if [[ $? != 0 ]] ;then
crontab –l > /tmp/crontab1
echo “0 * * * * /scitex/version/scripts/check-redundancy.sh” >> /tmp/crontab1
crontab /tmp/crontab1
fi
#Check what errors exist in errpt:
if errpt |grep STALE > /dev/null;then
STRINGDISK="One of the system disks has failed !"
FAILURE=1
fi
if crontab –l |grep “cooling problem” > /dev/null;then
STRINGFAN="One of the FANs has failed !"
FAILURE=1
fi
if crontab –l |grep “power problem” > /dev/null;then
STRINGPS="The power supply has failed !"
FAILURE=1
fi
if [[ $FAILURE = 1 ]] ;then
#Send mail to “backup” :
echo “$STRING\n\n$STRINGDISK\n\n$STRINGPS\n\n$STRINGFAN\n\n$STRINGCALL" > /tmp/error
/usr/bin/mail –s “System failures” backup < /tmp/error
#Notify MAC users.
/scitex/version/usr/local/es/etc/afpmsg “$STRING $STRINGDISK $STRINGPS $STRINGFAN $STRINGCALL"
#Send long beep to the bell
sh -c "echo \\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a"
#This is the display part:
# Create temp script:
echo "#!/bin/sh \necho \`date +\"%T\"\` \\nbanner \"$STRING\" \\necho \"$STRINGDISK\" \\necho \"$STRINGPS\" \\necho \"$STRINGFAN\" \\necho \”$STRINGCALL\” \\nread JUNK" > /scitex/version/scripts/msg_tmp
chmod 777 /scitex/version/scripts/msg_tmp
# Kill existing dialog
kill -9 `ps -ef | grep "sh -c /scitex/version/scripts/msg_tmp" |grep -v grep |awk '{print $2}'` > /dev/null 2>&1
# Execute in window
TERM_TYPE=`echo $TERM`
if ps –ef|grep xinit |grep –v grep > /dev/null ;then
aixterm -T "$TITLE" -bg $BG -fg $FG -cr $CR -geometry 80x$ROWS+0+0 -e /bin/sh -c /scitex/version/scripts/msg_tmp & #> /dev/null 2>&1 # Hide errors in case font missing
else #vt term
echo "echo \"\n\n\"" > msg_tmp.vt
grep -v read /scitex/version/scripts/msg_tmp >> msg_tmp.vt 2>/dev/null # lose the line that pauses for input
echo "echo \"\n\n\"" >> msg_tmp.vt
chmod 777 /scitex/version/scripts/msg_tmp.vt
/scitex/version/scripts/msg_tmp.vt
fi
fi
"Long live king Moshiach !"
h