diff --git a/scripts/mled-discomode b/cycle-colors.sh similarity index 74% rename from scripts/mled-discomode rename to cycle-colors.sh index 9050339..aa33a87 100755 --- a/scripts/mled-discomode +++ b/cycle-colors.sh @@ -1,12 +1,12 @@ #!/bin/bash REFRESHRATE=1 -LEDCONTROLLER="/usr/bin/ledcontroller" +LEDCONTROLLER="./ledcontroller" while (true); do for discoColor in blue red green aqua purple yellow white; do - + echo Set color $discoColor $LEDCONTROLLER $discoColor sleep "$REFRESHRATE" diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index 71380c5..0000000 --- a/scripts/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Bash Scripts # - -I teared the notifier apart and placed the notifier's board inside my home server. -Due to its size, the RGB LED creates some interesting optical effects if you place it 2-4cm -behind the venting holes. - -Here are some simple scripts that use various data to set the LED's color. - - - -## mled-discomode ## - -This script simply cycles through all available colors. I called it disco mode due to the optical -phenomena that take place as the light crosses the air vents. - - - -## mled-cputemp ## - -This script works really well for my machine. It uses the `sensors` program to get the CPU -temperature. - -If the CPU is at or under the low threshold, the LED turns blue. If it is at or above the -high threshold, the LED turns red. If it is in the middle, it gets green. - -It is actually very informative for the machine's state. You can easily detect CPU load. - - - -## mled-iowait, mled-iowaitdetailed ## - -My home server doesn't have any LEDs for HDD activity, though it has plenty of HDDs. -These two scripts attempt to make up for this shortcoming when I need some quick profiling of the machine. -They actually work better than common HDD activity LEDs because they are based on iowait percentage in one -second periods (adjustable). - -`mled-iowait` has 3 levels, so you get only to set a low and a high threshold. - -`mled-iowaitdetailed` has 6 levels of activity, so you can set 5 thresholds. Also below the lowest threshold, -it sets the notifier to off, which turns to be a good approach. diff --git a/scripts/mled-cputemp b/scripts/mled-cputemp deleted file mode 100755 index 70a6820..0000000 --- a/scripts/mled-cputemp +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -LOWTEMP=46 -HIGHTEMP=53 -REFRESHRATE=1 -LEDCONTROLLER="/usr/bin/ledcontroller" - - -while (true); do - - temperature="$(sensors|grep 'id 0'|sed -e 's/\.0.*//' -e 's/.*+//')" - - if (( "$temperature" <= "$LOWTEMP" )); then - - $LEDCONTROLLER blue; - - elif (( "$temperature" < "$HIGHTEMP" )); then - - $LEDCONTROLLER green; - - else $LEDCONTROLLER red; - - fi; - - sleep "$REFRESHRATE"; - -done - diff --git a/scripts/mled-iowait b/scripts/mled-iowait deleted file mode 100755 index a948261..0000000 --- a/scripts/mled-iowait +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -LOWTHRESHOLD="1.01" -HIGHTHRESHOLD="30.2" -REFRESHRATE=1 - -LEDCONTROLLER="/usr/bin/ledcontroller" - - -iostat -c "$REFRESHRATE" | while read iostatOutput; do - - iowaitPercent="$(echo "$iostatOutput" | grep -vE "Linux|avg|^$" | awk '{print $4}')" - - [ -z "$iowaitPercent" ] || \ - if (( $(bc <<< "$iowaitPercent > $LOWTHRESHOLD") == 0 )); then - - $LEDCONTROLLER blue - - elif (( $(bc <<< "$iowaitPercent > $HIGHTHRESHOLD") == 0 )); then - - $LEDCONTROLLER green - - else - - $LEDCONTROLLER red - - fi - -done - - -# This is an older version of the code, which used /proc/stats to do a similar job. - -#iowaitCounter="$(grep 'cpu ' /proc/stat | cut -f 9 -d ' ')" -#$LEDCONTROLLER blue -#ledcolor="blue" -# -#while (true); do -# -# iowaitTemp="$(grep 'cpu ' /proc/stat | cut -f 9 -d ' ')" -# -## echo "iowaitCounter=$iowaitCounter, iowaitTemp=$iowaitTemp" -# -# if (( "$iowaitCounter" == "$iowaitTemp" )); then -# -# if [ "$ledcolor" != "blue" ]; then -# -# $LEDCONTROLLER blue -# ledcolor="blue" -# -# fi -# -# else -# -# iowaitCounter="$iowaitTemp" -# -# if [ "$ledcolor" != "red" ]; then -# -# $LEDCONTROLLER red; -# ledcolor="red" -# -# fi -# -# fi -# -# sleep "$REFRESHRATE"; -# -#done - - diff --git a/scripts/mled-iowaitdetailed b/scripts/mled-iowaitdetailed deleted file mode 100755 index d5ac6c4..0000000 --- a/scripts/mled-iowaitdetailed +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -THRESH1="1.00" -THRESH2="5.00" -THRESH3="20.00" -THRESH4="40.00" -THRESH5="80.00" -REFRESHRATE=1 - -LEDCONTROLLER="/usr/bin/ledcontroller" - - -iostat -c "$REFRESHRATE" | while read iostatOutput; do - - iowaitPercent="$(echo "$iostatOutput" | grep -vE "Linux|avg|^$" | awk '{print $4}')" - - [ -z "$iowaitPercent" ] || \ - if (( $(bc <<< "$iowaitPercent > $THRESH1") == 0 )); then - - $LEDCONTROLLER off - - elif (( $(bc <<< "$iowaitPercent > $THRESH2") == 0 )); then - - $LEDCONTROLLER green - - elif (( $(bc <<< "$iowaitPercent > $THRESH3") == 0 )); then - - $LEDCONTROLLER aqua # blue and green - - elif (( $(bc <<< "$iowaitPercent > $THRESH4") == 0 )); then - - $LEDCONTROLLER blue - - elif (( $(bc <<< "$iowaitPercent > $THRESH5") == 0 )); then - - $LEDCONTROLLER purple # red and blue - - else - - $LEDCONTROLLER red - - fi - -done