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 / libexec / ipadm_ffdc.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2010-11-10  |  2KB  |  81 lines

  1. #!/bin/bash
  2. # FFDC script to capture ipadm debugging data when bad things happen
  3.  
  4. # name of ipadmd process
  5. ipadmd_name="ipadmd"
  6.  
  7. # pids <- list of pids of processes named ipadmd
  8. pids=`ps --no-headers --format pid -C ${ipadmd_name}`
  9.  
  10. # get rid of the leading spaces
  11. pidsnospaces=`echo "$pids" | tr -d \[\:blank\:\]`
  12.  
  13. echo ${ipadmd_name} pids ${pidsnospaces}
  14.  
  15. if [ -z "${pidsnospaces}" ]
  16. then
  17.     echo "${ipadmd_name}" is dead
  18.     echo 'ls -al /tmp/ip*'
  19.     /bin/ls -al /tmp/ip*
  20.     if [ -r /tmp/ipadmd_log.txt ]
  21.     then
  22.         echo '/tmp/ipadmd_log.txt'
  23.         cat /tmp/ipadmd_log.txt
  24.     else
  25.         echo '/tmp/ipadmd_log.txt is absent'
  26.     fi
  27.  
  28.     if [ -r /etc/ipadmd_log.txt ]
  29.     then
  30.         echo '/etc/ipadmd_log.txt'
  31.         cat /etc/ipadmd_log.txt
  32.     else
  33.         echo '/etc/ipadmd_log.txt is absent'
  34.     fi
  35.  
  36.     exit 0
  37. fi
  38.  
  39. # pid1 <- the first pid from the above list
  40. pid1=`expr match "$pidsnospaces" '\([0-9]*\)'`
  41.  
  42. # send SIGUSR1 to ipadmd to generate its debug file
  43. # also toggles ipadmd debug flag on
  44. echo sending SIGUSR1 to ${pid1}
  45. /bin/kill -s USR1 ${pid1}
  46.  
  47. # give OS a couple of seconds to deliver the signal
  48. sleep 3
  49.  
  50. # toggle ipadmd debug flag back off
  51. /bin/kill -s USR1 ${pid1}
  52.  
  53. # send the debug data to stdout so FFDC can capture it
  54. echo 'ls -al /tmp/ip*'
  55. /bin/ls -al /tmp/ip*
  56. if [ -r /tmp/ipadm_data.txt ]
  57. then
  58.     echo '/tmp/ipadm_data.txt'
  59.     cat /tmp/ipadm_data.txt
  60. else
  61.     echo '/tmp/ipadm_data.txt is absent'
  62. fi
  63.  
  64. if [ -r /tmp/ipadmd_log.txt ]
  65. then
  66.     echo '/tmp/ipadmd_log.txt'
  67.     cat /tmp/ipadmd_log.txt
  68. else
  69.     echo '/tmp/ipadmd_log.txt is absent'
  70. fi
  71.  
  72. if [ -r /etc/ipadmd_log.txt ]
  73. then
  74.     echo '/etc/ipadmd_log.txt'
  75.     cat /etc/ipadmd_log.txt
  76. else
  77.     echo '/etc/ipadmd_log.txt is absent'
  78. fi
  79.  
  80. exit 0
  81.