Advertisement
Guest User

ugen.sh

a guest
Feb 18th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. Run this in the directory where your *.log files are :)
  2. or ugen.sh | grep -v " 0 hrs"
  3. For me 192\.168\. matches my solo mining runs/test runs which I ignored for this
  4.  
  5. #!/bin/sh
  6. #
  7. numbers()
  8. {
  9.  m2="Runtime:|Pool:|] Average hashrate:"
  10.  egrep "Utility \(accepted shares / min\)|$m2" "$1"
  11. }
  12. #
  13. value()
  14. {
  15.  echo "$1" | grep "$2" | cut -d':' -f4-
  16. }
  17. #
  18. nums()
  19. {
  20.  tr -dc "0123456789."
  21. }
  22. #
  23. process()
  24. {
  25.  data="`numbers "$1" 2> /dev/null`"
  26.  if [ "$data" ] ; then
  27.     haspool="`echo "$data" | grep "Pool:" | grep -v 192\.168\.`"
  28.     if [ "$haspool" ] ; then
  29.         hasrun="`echo "$data" | grep "Runtime:"`"
  30.         if [ "$hasrun" ] ; then
  31.             runtime="`value "$data" Runtime`"
  32.             utility="`value "$data" Utility | nums`"
  33.             hash="`value "$data" hashrate | nums`"
  34.  
  35.             echo "$1,$runtime,$utility,$hash"
  36.         fi
  37.     fi
  38.  fi
  39. }
  40. #
  41. for i in `ls -rt *.log` ; do
  42.  process "$i"
  43. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement