#!/bin/bash # Script pour configurer la tâche cron hebdomadaire # Ce script ajoute une tâche cron pour exécuter le récapitulatif chaque dimanche à 18h00 SCRIPT_DIR="/opt/container/scripts" SCRIPT_PATH="$SCRIPT_DIR/plex-weekly-recap.py" CRON_JOB="0 18 * * 0 python3 $SCRIPT_PATH" # Vérifier si la tâche existe déjà if crontab -l 2>/dev/null | grep -q "$SCRIPT_PATH"; then echo "La tâche cron existe déjà." echo "Pour la modifier, utilisez: crontab -e" else # Ajouter la tâche cron (crontab -l 2>/dev/null; echo "$CRON_JOB") | crontab - echo "Tâche cron ajoutée avec succès !" echo "Le script s'exécutera chaque dimanche à 18h00" echo "" echo "Pour voir les tâches cron : crontab -l" echo "Pour éditer les tâches cron : crontab -e" fi