daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Apr 9th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Check interval seconds
  3. CHECKINTERVAL=0.1
  4.  
  5. # console
  6. CONSOLE=/dev/console
  7.  
  8. #indicator to use [caps, num, scroll]
  9. INDICATOR=num
  10.  
  11. getVmstat() {
  12.   cat /proc/vmstat|egrep "pgpgin|pgpgout"  
  13. }
  14. #turn led on
  15. function led_on()
  16. {
  17.     setleds -L +${INDICATOR} < ${CONSOLE}
  18. }
  19. #turn led off
  20. function led_off()
  21. {
  22.     setleds -L -${INDICATOR} < ${CONSOLE}
  23. }
  24. # initialise variables
  25. NEW=$(getVmstat)
  26. OLD=$(getVmstat)
  27. ##
  28. while [ 1 ] ; do
  29.   sleep $CHECKINTERVAL # slowdown a bit
  30.   # get status
  31.   NEW=$(getVmstat)
  32.   #compare state
  33.   if [ "$NEW" = "$OLD" ]; then  
  34.     led_off ## no change, led off
  35.   else
  36.     led_on  ## change, led on
  37.   fi
  38.   OLD=$NEW  
  39. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top