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 / fabos / bin / pdul_misc_post.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2010-11-10  |  2KB  |  64 lines

  1. #!/bin/sh
  2. #
  3. #  Panic Dump, UP Load Post-Fabos parameters.
  4. #  some of the paramters can be obtained only ater the fabos is up and
  5. #  running, such as WWN.
  6. #  This script is used to obtain such information and upload them to
  7. #  PD_MISC client of panicdump, so we get them when the system panics
  8. #  in future.
  9. #
  10. MISC_FILE=/core_files/panic/system_sym  # if you change this, also change
  11.                                 # corresponding entry in pdul_misc_pre.sh and
  12.                                 # pdul_misc_post.sh and pdcheck.sh
  13. #
  14. # we will take a copy of /proc/kallsyms, so the panic analyzers can take a
  15. # look at it if they ever want to
  16. #
  17. PATH=/bin:/usr/bin
  18.  
  19. # Discard error output. There are several sources of error
  20. # The MISC_FILE could be missing, md5sum will complain
  21. exec 2>/dev/null
  22.  
  23. consolelog(){
  24.     # copy a line at a time to /proc/consolelog
  25.     # We need to do this because of the "interesting" way consolelog is
  26.     # implemented. If we have a later version of GNU sed that
  27.     # implements the "-u" switch we could use that instead.
  28.     while read -r line
  29.     do
  30.         printf "%s\n" "$line" > /proc/consolelog
  31.     done
  32. }
  33.  
  34. # Copy kallsyms to $MISC_FILE only if it has changed (to avoid flash wear)
  35. # md5sum outputs hash, filename pairs, so $2 & $4 are the filenames and $1 & $3
  36. # are the hashes. $3 is unset if the second file is missing
  37. set -- $(/usr/bin/md5sum /proc/kallsyms $MISC_FILE )
  38. if [ "$1" != "$3" ]
  39. then
  40.     umask 022
  41.     # create any missing directories
  42.     mkdir -p ${MISC_FILE%/*}
  43.     cp /proc/kallsyms $MISC_FILE
  44.     sync
  45. fi
  46.  
  47.  
  48. sleep 60  # we wait so that we get all the info below
  49.  
  50. if [ -f /fabos/cliexec/hashow ]
  51. then
  52.     # Let us store the HAM information
  53.     printf "Section=HA Show Output\n" > /proc/pdmisc
  54.     /fabos/cliexec/hashow | /bin/sed -e 's/^/haShow=/' | consolelog
  55. fi
  56.  
  57.  
  58. printf "Section=sin Output\n" > /proc/pdmisc
  59. /sbin/sin | /bin/sed -e 's/^/sin=/' | consolelog
  60.  
  61. #setting the ROLE_ID to avoid RBAC failure.
  62. wwnnumber=$(ROLE_ID=root /fabos/bin/wwn)
  63. printf "WWN=$wwnnumber\n" > /proc/consolelog
  64.