getInfo 2.17.2

This commit is contained in:
kyodev 2017-10-26 00:40:16 +02:00
parent 86dacb3674
commit 17ec45dbfc
2 changed files with 25 additions and 27 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.17.1
version=2.17.2
date="25/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -318,7 +318,7 @@ f_display(){ # 25/10/2017
display+='``` \n'
display+="${!1} \n"
display+='``` \n'
echo -e "$display" >> "$fileOutput" # flush fonction
echo -en "$display \n" >> "$fileOutput" # flush fonction
}
# $1 répertoire à scanner, $2 profondeur
@ -426,8 +426,8 @@ fi_disk(){ # 25/10/2017
for idisk in $fget_disk_fixe; do
[ -r "/dev/$idisk" ] || continue
tempodd="$(LC_ALL=C hddtemp /dev/$idisk | cut -d ':' -f3 | sed 's/[^0-9]*//g; /not available/d')"
dd_temp+="$idisk: $tempodd °C"$' \n'
[ "$tempodd" -ge 50 ] && dd_temp_alert+="/!\ $idisk: température > 50°C) "$' \n'
dd_temp+="$idisk: $tempodd °C"$'\n'
[ "$tempodd" -ge 50 ] && dd_temp_alert+="/!\ $idisk: température > 50°C) "$'\n'
done
dd_temp=${dd_temp::-1} # suppression dernier $'\n'
dd_temp_alert=${dd_temp_alert::-1} # suppression dernier $'\n'
@ -1144,10 +1144,10 @@ figet_batt(){ #v2 25/10/2017
batt_detail+="($(cat $batRep/$ibat/model_name 2>/dev/null)) $(cat $batRep/$ibat/technology 2>/dev/null) "
batt_detail+="$batt_capa_design$batt_unit - $batt_volt_min""V / $batt_volt_now""V (mini/actuel) "
[ "$batt_sn" ] && batt_detail+="n° série: $batt_sn "
[ "$batt_cycle" != "0" ] && batt_detail+="$batt_cycle cycles"$' \n' || batt_detail+=$' \n'
[ "$batt_cycle" != "0" ] && batt_detail+="$batt_cycle cycles"$'\n' || batt_detail+=$'\n' #ln 1fin
[ "$batt_capa_full" ] && batt_detail+="pleine charge effective: $batt_capa_full$batt_unit, "
batt_detail+="pleine charge théorique: $batt_capa_design$batt_unit => "
if [ "$batt_conso" != "0" ]; then
if [ "$batt_conso" != "0" ]; then # conso éventuelle
if [ "$batt_unit" == "mAh" ]; then
batt_restant+="(consommation en cours: $(printf "%'d" $batt_conso)$(sed 's/h//' <<< $batt_unit), "
batt_restant+="charge actuelle: $(printf "%'d" $batt_capa_now)$batt_unit)"
@ -1156,22 +1156,20 @@ figet_batt(){ #v2 25/10/2017
batt_restant+="charge actuelle: $(printf "%s" $batt_capa_now)$batt_unit)"
fi
fi
[ "$batt_sante" ] && batt_detail+="$batt_sante% (indicateur)"$' \n'
[ "$batt_restant" ] && batt_detail+="$batt_restant"$' \n'
[ "$batt_sante" ] && batt_detail+="$batt_sante% (indicateur)"$'\n' #ln 2fin
[ "$batt_restant" ] && batt_detail+="$batt_restant"$'\n' #ln 3fin
# alertes batterie
[ "$alert_batt_alarm" ] && batt_detail+="**batterie en alarme** $alert_batt_alarm "
[ "$alert_batt_alarm" ] && batt_detail+="**batterie en alarme** $alert_batt_alarm "$'\n' #[ln 4]
if [ "$batt_capa_design" == "$batt_capa_full" ] && [ "$batt_volt_min" == "$batt_volt_now" ]; then
batt_detail+="les pleines charges et les voltages sont incohérents, batterie "
batt_detail+="mal gérée ou batterie HS "
batt_detail+="mal gérée ou batterie HS?"$'\n' #[ln 5]
fi
if [ "$(awk '{printf "%d", $1}' <<< $batt_sante)" -lt 50 ] && [[ "$batt_status" == "Full" || "$batt_status" == "Unknown" ]]; then
batt_detail+="batterie mal chargée: mauvais état"$' \n'
else
batt_detail+=$' \n'
batt_detail+="batterie très mal chargée (moins de 50%): mauvais état?"$'\n' #[ln 5]
fi
done
fget_batt=${batt_detail::-1} # suppression dernier $'\n'
fget_batt_nb="$batt_nb"
fget_batt=${batt_detail::-1} # suppression dernier $'\n'
}
# assigne $fget_cpu (3 lignes description cpu)
@ -1365,8 +1363,8 @@ figet_dmi(){ # 23/10/2017
tempo=$(sed 's/x.xx*//; s/To be filled by O\.E\.M\.//g' <<< $tempo | xargs)
bios+="$tempo "
done
fget_dmi=$(printf '%7s: %s' "produit" "$product")$' \n'
[ "$indic1" != "$indic2" ] && fget_dmi+=$(printf '%7s: %s' "board" "$board")$' \n'
fget_dmi=$(printf '%7s: %s' "produit" "$product")$'\n'
[ "$indic1" != "$indic2" ] && fget_dmi+=$(printf '%7s: %s' "board" "$board")$'\n'
fget_dmi+=$(printf '%7s: %s' "bios" "$bios")
# for idmi in chassis_vendor chassis_version chassis_type; do
# tempo=$(cat /sys/class/dmi/id/$idmi 2>/dev/null)
@ -1441,7 +1439,7 @@ figet_hw(){ #v2 14/10/2017
[ "$critT" ] && temp+="(crit: $critT""°C) "
[ "$hystT" ] && temp+="(hyst: $hystT""°C) "
[ "$maxiT" ] && temp+="(maxi: $maxiT""°C) "
[ "$temp" ] && temp+=$' \n'
[ "$temp" ] && temp+=$'\n'
fi
fi
## FAN
@ -1455,7 +1453,7 @@ figet_hw(){ #v2 14/10/2017
[ "$inputF" ] && inputF=${inputF::-1}
# formation affichage
if [ "$inputF" ]; then
fan+="$(printf "%-8s %st/mn %s" "$name" "$inputF" "$labelF")"$' \n'
fan+="$(printf "%-8s %st/mn %s" "$name" "$inputF" "$labelF")"$'\n'
fi
fi
done
@ -1620,24 +1618,24 @@ figet_mem(){ # 13/10/2017
unset fget_mem
if [[ ! "$*" =~ notitle ]]; then
[[ "$*" =~ nocoltitle ]] || col="mém.:"
fget_mem="$col totale utilisée disponible"$' \n'
fget_mem="$col totale utilisée disponible"$'\n'
fi
if [[ "$*" =~ mem ]]; then
[[ "$*" =~ nocoltitle ]] || col="ram :"
fget_mem+="$col$MemTotal$MemUsed$MemAvailable"$' \n'
fget_mem+="$col$MemTotal$MemUsed$MemAvailable"$'\n'
fi
if [[ "$*" =~ swap ]]; then
[[ "$*" =~ nocoltitle ]] || col="swap:"
fget_mem+="$col$SwapTotal$SwapUsed$SwapFree"$' \n'
fget_mem+="$col$SwapTotal$SwapUsed$SwapFree"$'\n'
fi
if [[ "$*" =~ total ]]; then
[[ "$*" =~ nocoltitle ]] || col="tot.:"
fget_mem+="$col$totalTotal$totalUsed$totalAvailable"$' \n'
fget_mem+="$col$totalTotal$totalUsed$totalAvailable"$'\n'
fi
if [ "$2" == "debug" ]; then
local espace=$(printf '% 6s')
fget_mem="$espace""mém.: totale utilisée libre shared buffers cache disponible"$' \n'
fget_mem+="$espace""ram :$MemTotal$MemUsed$MemFree$Shmem$Buffers$Cached$MemAvailable"$' \n'
fget_mem="$espace""mém.: totale utilisée libre shared buffers cache disponible"$'\n'
fget_mem+="$espace""ram :$MemTotal$MemUsed$MemFree$Shmem$Buffers$Cached$MemAvailable"$'\n'
fget_mem=${fget_mem::-1} # suppression dernier $'\n'
echo "$fget_mem"
echo "$freeDebug"
@ -2123,7 +2121,7 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_graph
fi_batt
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -8,14 +8,14 @@
* "alertifier" fi-reseau
* refaire/revoir figet_resolution
* revoir modules réseau
* bat une ligne de trop, idem lspci tester dernier caractère
* réviser alert_
---
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
* f__cmd_exist f__sudo f__requis
## 2.17.1 25/10/2017
## 2.17.2 25/10/2017
* révision: batterie, unité en W au lieu de mW, mA inchangé
* fix: fi_locale compatible fedora (arch ok)