logcolstat.sh 950 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. if [ $2 = "NO" ]; then
  3. ls $1_sql_*.log >/dev/null 2>&1
  4. if [ $? -eq 0 ] ; then
  5. grep -h "${1}: CT-[0-9][0-9][0-9][0-9][0-9]: WARNING:" $1_sql_*.log >>$1_warnings.log 2>/dev/null
  6. grep -h "${1}: CT-[0-9][0-9][0-9][0-9][0-9]: ERROR:" $1_sql_*.log >>$1_errors.log 2>/dev/null
  7. grep -h "${1}: CT-[0-9][0-9][0-9][0-9][0-9]: COLLECTED:" $1_sql_*.log >>$1_collected.log 2>/dev/null
  8. fi
  9. else #YES = final check
  10. grep 'LOCAL' db_list.csv >/dev/null 2>&1
  11. if [ $? -eq 1 ] ; then
  12. echo 'DB: CT-02808: WARNING: There are no DB instances running on this machine' >>DB_warnings.log
  13. fi
  14. if [ -s DB_collected.log ]; then
  15. for line in `cat DB_collected.log | grep 'DB: CT-02000:'`
  16. do
  17. V_DB_NAME=`echo $line | cut -d' ' -f5`
  18. if [ -s DB_errors.log ] && [ "V_DB_NAME" != "" ] ; then
  19. grep -vi "DB: CT-02011: ERROR: Failed to connect to instance ${V_DB_NAME}:" DB_errors.log >err_temp.log
  20. mv err_temp.log DB_errors.log
  21. fi
  22. done
  23. fi
  24. fi