ShellCheck: Syntaxverbesserung
This commit is contained in:
parent
89f5ce612c
commit
21cb7cf026
@ -8,7 +8,6 @@
|
||||
|
||||
|
||||
DIGITEMP="$(type -P digitemp_DS9097)"
|
||||
PARAMETER="$*"
|
||||
|
||||
#Welche Werte soll es haben
|
||||
#-c Kofigurationsdatei
|
||||
@ -166,28 +165,28 @@ fi
|
||||
|
||||
|
||||
#Sollte "--fahrenheit" und "--celsius" gesetzt sein, wird das Script beendet
|
||||
if [ "$FAHRENHEIT" = "1" -a "$CELSIUS" = "1" ]
|
||||
if [ "$FAHRENHEIT" = "1" ] && [ "$CELSIUS" = "1" ]
|
||||
then
|
||||
echo 'Parameter "--celsius" and "--fahrenheit" gesetzt'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Sollte weder "--fahrenheit" noch "--celsius" gesetzt sein, wird CELSIUS aktiviert
|
||||
if [ "$FAHRENHEIT" = "" -a "$CELSIUS" = "" ]
|
||||
if [ "$FAHRENHEIT" = "" ] && [ "$CELSIUS" = "" ]
|
||||
then
|
||||
CELSIUS="1"
|
||||
fi
|
||||
|
||||
|
||||
#Sollte "--sensor_nr" und "--sensor_hex" gesetzt sein, wird das Script beendet
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" -a "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" ] && [ "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
then
|
||||
echo 'Parameter "--sensor_nr" and "--sensor_hex" gesetzt'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Sollte weder "--sensor_nr" noch "--sensor_hex" gesetzt sein, wird DISPLAY_SENSOR_HEX aktiviert
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "" -a "$DISPLAY_SENSOR_NR" = "" ]
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "" ] && [ "$DISPLAY_SENSOR_NR" = "" ]
|
||||
then
|
||||
DISPLAY_SENSOR_HEX="1"
|
||||
fi
|
||||
@ -212,10 +211,10 @@ STATUS_OK=0
|
||||
|
||||
for wert in $($DIGITEMP_EXEC -c "$CONFIG_PATH" -a -o"%s;%R;%.0C;%.0F" -q)
|
||||
do
|
||||
sensor_id=$(echo $wert | cut -d ";" -f 1)
|
||||
sensor_hex=$(echo $wert | cut -d ";" -f 2)
|
||||
celsius=$(echo $wert | cut -d ";" -f 3)
|
||||
fahrenheit=$(echo $wert | cut -d ";" -f 4)
|
||||
sensor_id=$(echo "$wert" | cut -d ";" -f 1)
|
||||
sensor_hex=$(echo "$wert" | cut -d ";" -f 2)
|
||||
celsius=$(echo "$wert" | cut -d ";" -f 3)
|
||||
fahrenheit=$(echo "$wert" | cut -d ";" -f 4)
|
||||
|
||||
#Debug flag
|
||||
#echo -e "sensor_id: $sensor_id; sensor_hex: $sensor_hex; celsius: $celsius; fahrenheit: $fahrenheit"
|
||||
@ -227,14 +226,14 @@ do
|
||||
then
|
||||
if [ "$celsius" -ge "$CRITICAL" ]
|
||||
then
|
||||
STATUS_CRITICAL=$(( $STATUS_CRITICAL + 1 ))
|
||||
STATUS_CRITICAL=$(( STATUS_CRITICAL + 1 ))
|
||||
#echo "ToDo: Ausgabe CRITICAL"
|
||||
elif [ "$celsius" -ge "$WARNING" ]
|
||||
then
|
||||
STATUS_WARNING=$(( $STATUS_WARNING + 1 ))
|
||||
STATUS_WARNING=$(( STATUS_WARNING + 1 ))
|
||||
#echo "ToDo: Ausgabe Warning"
|
||||
else
|
||||
STATUS_OK=$(( $STATUS_OK + 1 ))
|
||||
STATUS_OK=$(( STATUS_OK + 1 ))
|
||||
#echo "ToDo: Ausgabe OK"
|
||||
fi
|
||||
|
||||
@ -255,14 +254,14 @@ do
|
||||
then
|
||||
if [ "$fahrenheit" -ge "$CRITICAL" ]
|
||||
then
|
||||
STATUS_CRITICAL=$(( $STATUS_CRITICAL + 1 ))
|
||||
STATUS_CRITICAL=$(( STATUS_CRITICAL + 1 ))
|
||||
#echo "ToDo: Ausgabe CRITICAL"
|
||||
elif [ "$fahrenheit" -ge "$WARNING" ]
|
||||
then
|
||||
STATUS_WARNING=$(( $STATUS_WARNING + 1 ))
|
||||
STATUS_WARNING=$(( STATUS_WARNING + 1 ))
|
||||
#echo "ToDo: Ausgabe Warning"
|
||||
else
|
||||
STATUS_OK=$(( $STATUS_OK + 1 ))
|
||||
STATUS_OK=$(( STATUS_OK + 1 ))
|
||||
#echo "ToDo: Ausgabe OK"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user