statistics.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. cd "$(dirname "${0}")/.."
  3. fmt="%-10s: "
  4. printf "${fmt}" "stations"
  5. {
  6. for d in htdocs/stations/*
  7. do
  8. [ -d "${d}" ] && echo "1"
  9. done
  10. } | wc -l
  11. printf "${fmt}" "first"
  12. {
  13. for d in htdocs/stations/*/????/??
  14. do
  15. ls "${d}"/??/????\ *.xml | cut -d / -f 4-
  16. done
  17. } | sort | head -n 1
  18. printf "${fmt}" "last"
  19. {
  20. for d in htdocs/stations/*/????/??
  21. do
  22. ls "${d}"/??/????\ *.xml | cut -d / -f 4-
  23. done
  24. } | sort | tail -n 1
  25. printf "${fmt}" "days"
  26. {
  27. for d in htdocs/stations/*/????/??
  28. do
  29. ls -d "${d}"/??
  30. done
  31. } | wc -l
  32. printf "${fmt}" "broadcasts"
  33. {
  34. for d in htdocs/stations/*/????/??
  35. do
  36. ls "${d}"/??/????\ *.xml
  37. done
  38. } | wc -l
  39. printf "${fmt}" "podcasts"
  40. {
  41. ls -d htdocs/podcasts/*
  42. } | wc -l
  43. printf "${fmt}" "recordings"
  44. {
  45. for d in htdocs/enclosures/*/????/??
  46. do
  47. ls "${d}"/??/????\ *.* 2>/dev/null
  48. done
  49. } | wc -l
  50. echo "Disk usage..."
  51. echo " index.xml (day summary, gzip) : $(du -hsc htdocs/stations/*/????/??/??/index.xml.gz | fgrep total | cut -f 1)"
  52. # echo " non-index.xml (single broadcasts): $(ls -f htdocs/stations/*/????/??/??/index.xml | cut -d / -f 1-6 | xargs du -ksc --exclude index.xml --exclude='*.json' | fgrep total | cut -f 1) KiB"
  53. echo " broadcasts : $(du -hsc htdocs/stations | tail -n 1 | cut -f 1)"
  54. echo " broadcasts, no index : $(du -hsc --exclude 'index.xml.gz' htdocs/stations/*/???? | tail -n 1 | cut -f 1)"
  55. echo " broadcasts, no index, no json : $(du -hsc --exclude 'index.xml.gz' --exclude='*.json' htdocs/stations/*/???? | tail -n 1 | cut -f 1)"