mysqllog 443 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. if [[ "$1" = "" ]];then
  3. mysqllog more;
  4. else
  5. t=$1;
  6. shift;
  7. case "$t" in
  8. search)
  9. cat /var/log/mysql/error.log | grep "$@";
  10. ;;
  11. ignore)
  12. cat /var/log/mysql/error.log | grep -v "$@";
  13. ;;
  14. tail)
  15. tail --lines="$@" /var/log/mysql/error.log;
  16. ;;
  17. more)
  18. more /var/log/mysql/error.log;
  19. ;;
  20. *)
  21. echo "Usage: $0 [{search|ignore|tail|more} <params>]";
  22. exit 1;
  23. esac;
  24. fi;