Guest User

Untitled

a guest
Jul 30th, 2019
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #! /opt/cloverleaf/cis6.2/integrator/bin/hcitcl
  2. #
  3. #
  4. #
  5. ###########################
  6. proc main { argc argv } {
  7. set optargs [list {a 1 alert} {e 1 email} {f 1 filename}]
  8.  
  9. catch {set args [getopt $argv $optargs]} err
  10.  
  11. #echo ALERT:$alert
  12. #echo FILENAME:$filename
  13. #set thread [lindex [split $alert " "] 4]
  14. set thread unknown
  15. set tlist [split $alert "\{"]
  16. for { set i 1 } { $i < [llength $tlist] } { incr i } {
  17. set part [lindex $tlist $i]
  18. if { [regexp {^([^ ]+) (\d+)\}} $part -> threadm count] } {
  19. if { $count > 0 } {
  20. set thread $threadm
  21. }
  22. }
  23. }
  24.  
  25. #echo $thread
  26.  
  27. set subj "Error Message from PWIM - [clock format [clock seconds] -format "%D %R %p"] $alert"
  28. foreach flag { o f d } {
  29. catch {exec yes | hcidbdump -e -L -c -D -$flag $thread | fold} dump
  30. if {[llength [split $dump \n]] > 6} {
  31. write_file $filename $dump
  32. catch {[exec mailx -s $subj $email <$filename]} emailerr
  33. }
  34. }
  35. }
  36.  
  37. main $argc $argv
Advertisement
Add Comment
Please, Sign In to add comment