home *** CD-ROM | disk | FTP | other *** search
/ ftp.jcu.edu.au / 2014.06.ftp.jcu.edu.au.tar / ftp.jcu.edu.au / v6.3.2b / SWBD63 / fabos-6.3.2b-10.ppc.rpm / fabos-6.3.2b.10.cpio.gz / fabos-6.3.2b.10.cpio / sbin / kmsghandler < prev    next >
Text File  |  2010-11-10  |  1KB  |  46 lines

  1. #!/bin/sh
  2. #
  3. #    Copyright (c) 2010 Brocade Communications Systems, Inc.
  4. #    All rights reserved.
  5. #
  6. #    Check the kernel messages from syslogd and handle them accordingly.
  7. #
  8.  
  9. #
  10. # Finds out the pid of wdtd
  11. #
  12. wdtd_pid() {
  13.     /bin/ps -C wdtd -o pid=
  14. }
  15.  
  16. #
  17. # Handle the CF card error messages by setting a bootenv to indicate the
  18. # error and killing the wdtd to trigger a reboot. It doesn't rely on the
  19. # reboot command to reboot because it requires access to the CF card.
  20. #
  21. handle_badcf() {
  22.         echo "A fatal CF card failure has been detected. The system will" \
  23.            "be rebooted. Please contact your service provider for CF card" \
  24.        "replacement." 
  25.         echo "Rebooting in 30 seconds!!!"
  26.         kill -n 9 $wdtd_pid
  27.         /sbin/bootenv CFCardState bad
  28. }
  29.  
  30. wdtd_pid=$(wdtd_pid);
  31. while read line
  32. do
  33.         case "$line" in
  34.         (*hda*UncorrectableError*)
  35.                 echo ---$line;
  36.                 handle_badcf;;
  37.         (*hda*SectorIdNotFound*)
  38.                 echo ---$line;
  39.                 handle_badcf;;
  40.         (*hda*AddrMarkNotFound*)
  41.                 echo ---$line;
  42.                 handle_badcf;;
  43.         esac
  44. done < /var/log/kmsg
  45.  
  46.