From 90fc0d99d19214905dc6b9e274e2ac614ace16c7 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 5 Mar 2026 15:18:40 +0100 Subject: [PATCH] Actualiser run.sh Signed-off-by: thomas --- run.sh | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/run.sh b/run.sh index 1ed2f42..7c43ed6 100644 --- a/run.sh +++ b/run.sh @@ -1,10 +1,19 @@ #!/usr/bin/env bash set -euo pipefail -# 🧹 Nettoyage écran (uniquement si on a un terminal) -if [[ -t 1 ]]; then - clear -fi +# 🧹 Nettoyage écran +clear + +LOG_DIR="/var/log/lxc-updater-TM" +LOG_FILE="${LOG_DIR}/lxc-updater-run.log" + +mkdir -p "$LOG_DIR" +: > "$LOG_FILE" + +log() { + echo "$1" + echo "$1" >> "$LOG_FILE" +} BASE="https://git.thomasmlg.fr/thomas/Docker/raw/branch/release" DIR="/opt/lxc-updater" @@ -12,25 +21,18 @@ DIR="/opt/lxc-updater" mkdir -p "$DIR" cd "$DIR" -# 🧾 Tout logguer dans un fichier dès le début (run + update) -LOG="/var/log/lxc-updater-run.log" -mkdir -p /var/log -: > "$LOG" +log "🧰 Téléchargement des scripts" -# Redirige stdout/stderr vers le log, mais on garde l’affichage console via exec 3 -exec 3>&1 1>>"$LOG" 2>&1 +curl -fsSL "$BASE/detect.sh" -o detect.sh >>"$LOG_FILE" 2>&1 +curl -fsSL "$BASE/update.sh" -o update.sh >>"$LOG_FILE" 2>&1 -echo "🧰 Téléchargement des scripts..." >&3 -curl -fsSL "$BASE/detect.sh" -o detect.sh -curl -fsSL "$BASE/update.sh" -o update.sh chmod +x detect.sh update.sh METHOD="$(./detect.sh)" -# ✅ Affichage demandé -echo "🧭 Mode de mise à jour : $METHOD" >&3 +log "🧭 Mode de mise à jour : $METHOD" -# Lance update (ses sorties console restent à l’écran, et toutes les commandes vont au log interne) -./update.sh "$METHOD" >&3 +./update.sh "$METHOD" -echo "🧾 Log run : $LOG" >&3 \ No newline at end of file +log "🧾 Log run : $LOG_FILE" +log "🎉 Script terminé" \ No newline at end of file