thatsNotRight.sh 979 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 1#! /bin/bash
  2. # Create a report about Things That Are Not Right on my home Ubuntu system.
  3. #
  4. # Usage:
  5. #
  6. # thatsNotRight.sh
  7. #
  8. # Inputs:
  9. #
  10. # Outputs:
  11. # output on stdout for logging, mailing, grepping, etc.
  12. #
  13. #
  14. # Author: Geroge Jones
  15. # Date: 2014-11-16
  16. #
  17. #
  18. # When is this run ?
  19. #
  20. #
  21. # uptime
  22. #
  23. # Start simple with a (nonroot) cron like this
  24. #
  25. # 6 * * * * uptime >> ${HOME}/log/$(date +\%Y\%m\%d)_uptime.log
  26. #
  27. # then parse the output (should be 24 entries/day)
  28. # For more fancy solutions, see http://stackoverflow.com/questions/79490/linux-uptime-history
  29. updateLogfile=/home/george/log/$(date +\%Y\%m\%d)_uptime.log
  30. wc -l ${updateLogfile=} | sed 's/^/UptimeCount: /g'
  31. #
  32. # System reboots
  33. #
  34. last reboot | sed 's/^/lastReboot: /g'
  35. #
  36. # Bad login attempts
  37. #
  38. # Thanks to http://securitasdato.blogspot.com/2010/01/fun-with-lastb.html
  39. #
  40. lastb -i -a | head -20 | sed 's/^/lastb: /g'
  41. # Reporting bad behavior
  42. #
  43. # Possibly participate here http://www.blocklist.de/en/index.html
  44. #