' réorganisation ""

This commit is contained in:
2025-04-13 10:21:44 +02:00
parent d9cb01e788
commit 678a917423
6 changed files with 35 additions and 90 deletions

1
.idea/.name generated
View File

@@ -1 +0,0 @@
Général.py

29
Scripts/.deploy.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
LOG="/home/debian/travail/deploy.log"
REPO_PATH="/home/debian/travail/Gestion_sondes"
DATE=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$DATE] 🔄 Déploiement en cours depuis Gitea (branche product)..." >> $LOG
cd $REPO_PATH
# S'assurer d'être sur la bonne branche
git checkout product >> $LOG 2>&1
git pull origin product >> $LOG 2>&1
# Redémarrer les services Supervisor
for service in Cuisine_Saclay Monitor cuisine_meudon domo91
do
supervisorctl stop $service >> $LOG 2>&1
done
sleep 2
for service in Cuisine_Saclay Monitor cuisine_meudon domo91
do
supervisorctl start $service >> $LOG 2>&1
done
DATE_END=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$DATE_END] ✅ Déploiement terminé avec succès (branche product)" >> $LOG

View File

@@ -1,30 +0,0 @@
#!/bin/bash
# Fonction pour vérifier et relancer un processus
check_and_restart() {
process_name="$1"
log_file="$2"
script_path="$3"
# Vérifier si le processus est actif
if pgrep -af "$process_name" > /dev/null; then
echo "Le processus $process_name est actif."
else
echo "Le processus $process_name est mort."
# Demander à l'utilisateur s'il souhaite relancer le processus
read -p "Voulez-vous relancer le processus $process_name ? (O/N) " choice
if [ "$choice" = "O" ] || [ "$choice" = "o" ]; then
echo "Relancer le processus $process_name."
nohup python3 $script_path > $log_file 2>&1 &
else
echo "Ne rien faire pour le processus $process_name."
fi
fi
}
# Afficher les processus Python3 actifs et les vérifier
echo "Vérification des processus Python3 :"
check_and_restart "Cuisine.py" "/root/python/log/cuisine_saclay_output.log" "/root/python/Cuisine_saclay.py"
check_and_restart "Chaufferie.py" "/root/python/log/chaufferie_output.log" "/root/python/Chaufferie.py"
check_and_restart "Alertes_telegram.py" "/root/python/log/Alertes_telegram_output.log" "/root/python/Alertes_telegram.py"

View File

@@ -1,3 +1,6 @@
# mysqldump --defaults-file=/root/my.cnf -u michel Sondes > /root/syno/Sondes-$(date +%Y%m%d).sql
# mysqldump --defaults-file=/root/my.cnf -u michel --databases Sondes Best_Western >/root/syno/BW-$(date +%Y%m%d).sql
mysqldump --defaults-file=/root/my.cnf -u michel --databases Best_Western Sondes >/root/syno/BW-$(date +%Y%m%d).sql
# Fichier de sauvegarde BDD sur Syno en NFS
# Fichier my.cnf
#[mysqldump]
#user=root
#password=4V5t9P!Z2HgT#CLFes4cntEeNBWs
mysqldump --defaults-file=/home/debian/travail/my.cnf -u root --all-databases > /mnt/syno920/all-$(date +%Y%m%d).sql

View File

@@ -1,27 +0,0 @@
#!/bin/bash
# Fonction pour vérifier et redémarrer un container Docker
check_and_restart_container() {
container_name="$1"
# Vérifier si le container est en cours d'exécution
if docker ps --format '{{.Names}}' | grep -q "$container_name"; then
echo "Le container $container_name est en cours d'exécution."
else
echo "Le container $container_name n'est pas en cours d'exécution."
# Demander à l'utilisateur s'il souhaite redémarrer le container
read -p "Voulez-vous redémarrer le container $container_name ? (O/N) " choice
if [ "$choice" = "O" ] || [ "$choice" = "o" ]; then
echo "Redémarrer le container $container_name."
docker restart $container_name
else
echo "Ne rien faire pour le container $container_name."
fi
fi
}
# Afficher les containers Docker actifs et les vérifier
echo "Vérification des containers Docker :"
check_and_restart_container "domoticz"
check_and_restart_container "postfix"

View File

@@ -1,29 +0,0 @@
#!/bin/bash
# Fonction pour vérifier et relancer un processus
check_and_restart() {
process_name="$1"
log_file="$2"
# Vérifier si le processus est actif
if pgrep -af "$process_name" > /dev/null; then
echo "Le processus $process_name est actif."
else
echo "Le processus $process_name est mort."
# Demander à l'utilisateur s'il souhaite relancer le processus
read -p "Voulez-vous relancer le processus $process_name ? (O/N) " choice
if [ "$choice" = "O" ] || [ "$choice" = "o" ]; then
echo "Relancer le processus $process_name."
nohup $process_name > $log_file 2>&1 &
else
echo "Ne rien faire pour le processus $process_name."
fi
fi
}
# Afficher les processus Python3 actifs et les vérifier
echo "Vérification des processus Python3 :"
check_and_restart "python3 /root/python/Cuisine_saclay.py" "/root/python/log/cuisine_saclay_output.log"
check_and_restart "python3 /root/python/Chaufferie.py" "/root/python/log/chaufferie_output.log"
check_and_restart "python3 /root/python/Alertes_telegram.py" "/root/python/log/Alertes_telegram_output.log"