summaryrefslogtreecommitdiff
path: root/tempmon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tempmon.sh')
-rw-r--r--tempmon.sh20
1 files changed, 12 insertions, 8 deletions
diff --git a/tempmon.sh b/tempmon.sh
index 7fe99d9..3e752be 100644
--- a/tempmon.sh
+++ b/tempmon.sh
@@ -1,14 +1,18 @@
#!/bin/bash
+if [[ $# -ne 2 ]]; then
+ echo "Usage: $0 THRESHOLD COMMAND"
+fi
+
thresh=$1
-shift
+cmd=$2
while true; do
- num=`acpi -t|sed -nr 's/.*, ([0-9.]*) .*/\1/p`
- num=${num:-0}
- if (( "$num" > "$thresh" )); then
- eval "$*"
- else
- sleep 1
- fi
+ num=`acpi -t|sed -nr 's/.*, ([0-9.]*) .*/\1/p`
+ num=${num:-0}
+ if (( "$num" > "$thresh" )); then
+ eval "$cmd"
+ else
+ sleep 1
+ fi
done