maillog 504 B

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