Update grabber.sh

This commit is contained in:
squick 2025-11-14 11:57:38 +01:00
parent 3cc7f42499
commit 4f9dc45449

View File

@ -1,16 +1,40 @@
#!/bin/bash
# Définition des variables
DIR=/opt/grabber
SUCCESS_LOG=/var/log/grabber/grabber-success.log
ERROR_LOG=/var/log/grabber/grabber-error.log
echo "================" | tee -a /dev/stderr
echo "Début de grabber" | tee -a /dev/stderr
echo "================" | tee -a /dev/stderr
# Affichage du texte de démarrage
tee $SUCCESS_LOG $ERROR_LOG <<EOF1
++++++++++++++++++++++++
Démarrage du script Grabber
++++++++++++++++++++++++
========================
Récupération des informations sur les paquets
========================
EOF1
echo "================" | tee -a /dev/stderr
echo "Périphériques USB" | tee -a /dev/stderr
echo "================" | tee -a /dev/stderr
echo "Commande lsusb:" | tee -a /dev/stderr
# Fichier /etc/apt/sources.list
lsusb 1> $DIR/lsusb.cmd
tee $SUCCESS_LOG $ERROR_LOG <<EOF2
---------------------------------------------
Copie du fichier de configuration /etc/apt/sources.list
-------------------
EOF2
cat /etc/apt/sources.list 2> >(tee -a $ERROR_LOG) > sources-list.file
# Commande apt-list --installed
tee -a $SUCCESS_LOG $ERROR_LOG <<EOF3
---------------------------------------------
Récupération de la liste de paquets installés
-------------------
EOF3
apt list --installed 2> >(tee -a $ERROR_LOG) > apt-installed.cmd \
&& echo "[OK]: Fichier apt -installed.cmd généré" | tee -a $SUCCESS_LOG \
|| echo "[ECHEC]: Erreur à la génération de apt-installed.cmd" | tee -a $ERROR_LOG
#lsusb 1> $DIR/lsusb.cmd
#cat /etc/passwd > $DIR/passwd.file
#cat /etc/group > $DIR/group.file
#uptime > $DIR/uptime.cmd