getInfo 2.10.2

This commit is contained in:
kyodev 2017-10-20 00:50:21 +02:00
parent ffc588df7f
commit a34a91ea9e
2 changed files with 52 additions and 31 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.10.1
version=2.10.2
date="19/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -461,7 +461,7 @@ fi_disk(){ # 19/10/2017
echo -e "$text" >> "$fileOutput"
}
fi_dmesg(){ # v2 19/10/2017
fi_dmesg(){ #v2 19/10/2017
local dmesg_err dmesg_warn dmesg_crit file text nb_lignes=25
file="/tmp/$$-$RANDOM-dmesg"
[ "$EUID" -eq 0 ] || echo
@ -492,26 +492,27 @@ fi_dmesg(){ # v2 19/10/2017
rm "$file-"*
###
text="## dmesg kernel (emergency, alerte, erreur, warning ou critique) \n\n"
text+='`dmesg -l emerg`'" (emergency, $nb_lignes lignes maxi) \n"
text+='`dmesg -l emerg`'" (emergency, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$dmesg_emerg \n"
text+='```\n\n'
text+='`dmesg -l alert`'" (alerte, $nb_lignes lignes maxi) \n"
text+='`dmesg -l alert`'" (alerte, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$dmesg_alert \n"
text+='```\n\n'
text+='`dmesg -l crit`'" (critique, $nb_lignes lignes maxi) \n"
text+='`dmesg -l crit`'" (critique, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$dmesg_crit \n"
text+='```\n\n'
text+='`dmesg -l err`'" (erreur, $nb_lignes lignes maxi) \n"
text+='`dmesg -l err`'" (erreur, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$dmesg_err \n"
text+='```\n\n'
text+='`dmesg -l warn`'" (warning, $nb_lignes lignes maxi) \n"
text+='`dmesg -l warn`'" (warning, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$dmesg_warn \n"
text+='```\n\n'
text+="**les $nb_lignes premières lignes commencent à la date la plus ancienne encore dans les logs kernel** \n\n"
echo -e "$text" >> "$fileOutput"
}
@ -602,40 +603,41 @@ fi_journal(){ # 19/10/2017
###
# kernel
text="## journalctl kernel (emergency, alert, erreur, warning ou critique) \n\n"
text+='`journalctl --no-hostname --boot 0 -k -p 1`'" (emergency 0 & alerte 1, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -k -p 1`'" (emergency 0 & alerte 1, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_alert_k \n"
text+='```\n\n'
text+='`journalctl --no-hostname --boot 0 -k -p 2..2`'" (critique, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -k -p 2..2`'" (critique, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_crit_k \n"
text+='```\n\n'
text+='`journalctl --no-hostname --boot 0 -k -p 3..3`'" (erreur, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -k -p 3..3`'" (erreur, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_err_k \n"
text+='```\n\n'
text+='`journalctl --no-hostname --boot 0 -k -p 4..4`'" (warning, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -k -p 4..4`'" (warning, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_warn_k \n"
text+='```\n\n'
# non kernel
text+="## journalctl hors kernel (emergency, alert, erreur, warning ou critique) \n\n"
text+='`journalctl --no-hostname --boot 0 -p 1 | grep -v kernel:`'" (emergency 0 & alerte 1, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -p 1 | grep -v kernel:`'" (emergency 0 & alerte 1, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_alert_nok \n"
text+='```\n\n'
text+='`journalctl --no-hostname --boot 0 -p 2..2 | grep -v kernel:`'" (critique, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -p 2..2 | grep -v kernel:`'" (critique, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_crit_nok \n"
text+='```\n\n'
text+='`journalctl --no-hostname --boot 0 -p 3..3 | grep -v kernel:`'" (erreur, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -p 3..3 | grep -v kernel:`'" (erreur, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_err_nok \n"
text+='```\n\n'
text+='`journalctl --no-hostname --boot 0 -p 4..4 | grep -v kernel:`'" (warning, $nb_lignes lignes maxi) \n"
text+='`journalctl --no-hostname --boot 0 -p 4..4 | grep -v kernel:`'" (warning, $nb_lignes premières lignes) \n"
text+='```\n'
text+="$jctl_warn_nok \n"
text+='```\n\n'
text+="**les $nb_lignes premières lignes commencent à la date du dernier boot** \n\n"
echo -e "$text" >> "$fileOutput"
}
@ -685,14 +687,31 @@ et/ou installer le démon Ntp: apt install ntp \n"
echo -e "$text" >> "$fileOutput"
}
fi_log_xorg(){ # 11/10/2017
local logXorg text
logXorg="$(grep -Es '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.*.log /home/$user_/.local/share/xorg/Xorg.*.log)"
###
fi_log_xorg(){ #v2 19/10/2017
local logXorg xfile extract text nb_lignes=50
# Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice,
# (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown (WW) warning, (EE) erreur
# voir options appliquées par config file: cat /var/log/Xorg.0.log | grep -E '\(\*\*\)'
# voir options par défaut: cat /var/log/Xorg.0.log | grep -E '\(==\)'
text="## journaux Xorg \n\n"
text+='`'"grep -Es '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.?.log /home/<user>/.local/share/xorg/Xorg.?.log"'` (xorg.log) \n'
text+='`'"grep -Es '\(WW\)|\(EE\)|\(\?\?\)' /var/log/Xorg.?.log /home/<user>/.local/share/xorg/Xorg.?.log"'` (Xorg.log) \n'
text+='```\n'
text+="$logXorg \n"
for xfile in /var/log/Xorg.0.log /home/$user_/.local/share/xorg/Xorg.0.log ; do
if [ -e "$xfile" ]; then
extract="$(grep -Es '\(WW\)|\(EE\)|\(\?\?\)' $xfile | sed '/(WW) warning, (EE) error,/d')"
extract="$(sed -n 1,"$nb_lignes"p <<< $extract)"
if [ "$extract" ]; then
logXorg+="$xfile (WW) warning, (EE) erreur, (??) inconnu, $nb_lignes premières lignes maxi \n\n"
logXorg+="$(grep -E '\(EE\)' <<< $extract) \n"
logXorg+="$(grep -E '\(WW\)' <<< $extract) \n\n"
else
logXorg+="$xfile : <vide> \n\n"
fi
else
logXorg+="$xfile : inexistant\n\n"
fi
done
text+="${logXorg::-2}"
text+='```\n\n'
echo -e "$text" >> "$fileOutput"
}
@ -1075,7 +1094,7 @@ fi_usb(){ # 25/09/2017
}
# informations batterie(s), assigne $fget_batt_nb $fget_batt
figet_batt(){ # v2 17/10/2017
figet_batt(){ #v2 17/10/2017
local batt_detail batt_nb batt_alim batt_unit batt_capa_design batt_capa_full batt_capa_now batt_conso
local batt_volt_min batt_volt_now batt_status batt_cycle batt_sn alert_batt_alarm
local batt_sante batt_restant tempo batRep ibat uevent
@ -1269,7 +1288,7 @@ figet_de(){ # thanks neofetch, assigne $fget_de #14/10/2017
# $fget_disk_ata, $fget_disk_usb, $fget_disk_mmc, $fget_disk_nvme : liste disk ata, usb...
# $fget_disk_part_fixe_nm, $fget_disk_part_amov_nm : liste partitions non montées, fixes ou amovibles
# $fget_disk_part_fixe_m, $fget_disk_part_amov_m : liste partitions montées, fixes ou amovibles
figet_disk(){ # v2 19/10/2017
figet_disk(){ #v2 19/10/2017
local size type vendor_model serial_rev list_id idisk
# détail disques, séquence disques fixes et amovibles
unset fget_disk_fixe fget_disk_amov
@ -1318,10 +1337,10 @@ figet_disk(){ # v2 19/10/2017
# fget_disk_mmc="$(sed '/^mmc/!d; /part/d; /\/mmcblk/!d; s/^.*\(mmcblk..*\)$/\1/' <<< $list_id | tr '\n' ' ')"
fget_disk_mmc="$(sed '/^mmc/!d; /part/d' <<< $list_id | awk -F '/' '{print $NF}' | tr '\n' ' ')"
fget_disk_nvme="$(sed '/^nvme/!d; /part/d' <<< $list_id | awk -F '/' '{print $NF}' | tr '\n' ' ')"
[ "$fget_disk_ata" ] || fget_disk_ata="-"
[ "$fget_disk_usb" ] || fget_disk_usb="-"
[ "$fget_disk_mmc" ] || fget_disk_mmc="-"
[ "$fget_disk_nvme" ] || fget_disk_nvme="-"
[ "$fget_disk_ata" ] || fget_disk_ata="-" && fget_disk_ata="$(tr ' ' '\n' <<< "$fget_disk_ata" | sort | tr '\n' ' ')"
[ "$fget_disk_usb" ] || fget_disk_usb="-" && fget_disk_usb="$(tr ' ' '\n' <<< "$fget_disk_usb" | sort | tr '\n' ' ')"
[ "$fget_disk_mmc" ] || fget_disk_mmc="-" && fget_disk_mmc="$(tr ' ' '\n' <<< "$fget_disk_mmc" | sort | tr '\n' ' ')"
[ "$fget_disk_nvme" ] || fget_disk_nvme="-" && fget_disk_nvme="$(tr ' ' '\n' <<< "$fget_disk_nvme" | sort | tr '\n' ' ')"
}
figet_distro(){ # thanks neofetch, assigne $fget_distro # 09/10/2017
@ -2066,7 +2085,7 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_disk
fi_log_xorg
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -12,13 +12,15 @@
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
## 2.10.1 19/10/2017
## 2.10.2 19/10/2017
* nouveau: fi_journal, journaux kernel et non-kernel via journalctl, dmesg en fallback
* nouveau: fi_journal, journaux kernel et non-kernel via journalctl, dmesg en fallback, x premières lignes
* nouveau: fi_disk, ajout listes partitions fixes/amovibles, montées/non montées
* révision: fi_dmesg
* révision: figet_disk, tris des listes de disques par type
* révision: fi_dmesg, , x premières lignes
* révision: suppression option --dmesg, journaux via option -ca (fi_system_analyse fi_log_xorg fi_journal)
+ option -j
* révision: fi_log_xorg, trié par error ou warning, juste .0.log, x premières lignes
* fi_nonFree passsé en catégorie configuration (-cc), option équivalente -j
* fix: fi_dmesg, niveau emergency & alerte oublié
* fix: partitions en liste