Refactor temperature check and error handling
- Refactored code to improve readability and maintainability - Added error handling for when Temper USB is not found - Updated variable names for clarity
This commit is contained in:
parent
27313aec76
commit
2502f8c817
@ -89,7 +89,13 @@ script_name=$(basename "${0}")
|
|||||||
script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
GetOptions "$@"
|
GetOptions "$@"
|
||||||
|
|
||||||
val=$(temper --json | jq '.[0]."internal temperature"' | bc -l)
|
json=$(temper --json)
|
||||||
|
if [[ ${json} == '[]' ]]; then
|
||||||
|
echo "MEMORY UNKNOWN - Temper USB not found"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
val=$(echo ${json} | jq '.[0]."internal temperature"' | bc -l)
|
||||||
|
|
||||||
if (( $(echo "$val < ${critmin}" | bc -l) )); then
|
if (( $(echo "$val < ${critmin}" | bc -l) )); then
|
||||||
rval=2
|
rval=2
|
||||||
|
Loading…
Reference in New Issue
Block a user