checkLoad.sh 332 B

12345678910111213141516
  1. #!/bin/bash
  2. # Bail if the load average is high
  3. LOAD="`uptime | awk -F ': ' '{print $2}' | cut -d '.' -f 1`"
  4. CPU_COUNT="`sysctl -n hw.ncpu`"
  5. if [ $LOAD -gt $(( 2 * $CPU_COUNT )) ]; then
  6. exit 1
  7. fi
  8. # Bail if WoW is running
  9. if ps auwx | grep -v grep | grep -q "World of Warcraft-64"; then
  10. exit 1
  11. fi
  12. # Otherwise exit cleanly
  13. exit 0