No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sysmon.sh 826B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. #
  3. # dtch - (c) wtfpl 2014
  4. # fetch system info and print it every second
  5. # get date and print as 'DAY MONTH HOUR.MINUTE'
  6. # if you don't know the year, you're an idiot
  7. dt() {
  8. date +'%a %b %H.%M'
  9. }
  10. # get volume from amixer
  11. vol() {
  12. amixer get PCM | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq
  13. }
  14. # get song info from mpc
  15. music() {
  16. mpc current
  17. }
  18. # get memory
  19. mem() {
  20. read t f <<< `grep -E 'Mem(Total|Free)' /proc/meminfo | awk '{print $2}'`
  21. bc <<< "scale=2; 100 - $f / $t * 100" | cut -d. -f1
  22. }
  23. # get cpu
  24. cpu() {
  25. LINE=`ps -eo pcpu | grep -vE '^\s*(0.0|%CPU)' | sed -n '1h;$!H;$g;s/\n/ +/gp'`
  26. bc <<< $LINE
  27. }
  28. output() {
  29. echo -e "
  30. clock\t $(dt)
  31. music\t $(music)
  32. volume\t $(vol)%
  33. mem\t\t $(mem)%
  34. cpu\t\t $(cpu)%"
  35. }
  36. while :; do
  37. output
  38. sleep 1
  39. #clear
  40. done