Created
March 31, 2020 06:48
-
-
Save nkirnos/dd5fb4711f655b1a0c15199f24d5ae2d to your computer and use it in GitHub Desktop.
power off when low loadaverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/bash | |
| load=$(cat /proc/loadavg | awk '{ print $2}') | |
| threshold=0.3 | |
| echo $load | |
| check=$(echo "$threshold > $load" | /usr/bin/bc) | |
| if test "$check" = "1"; then | |
| sudo /sbin/shutdown now | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment