# ============================================================================
# Crontab — Mise à jour quotidienne des pages Re-info.fr via opencode
# ============================================================================
#
# Installation :
#   crontab /home/alan/SITE/CRON/crontab.txt
#
# Vérification :
#   crontab -l
#
# Logs : /home/alan/SITE/CRON/logs/
#
# Organisation :
#   - 64 pages mises à jour une fois par jour
#   - Démarre à 22h00, 5 minutes entre chaque page
#   - Dernière mise à jour à 03h15 (Pierre de Gaulle)
#   - Transfert FTP à 04h00
#   - Sauvegarde quotidienne à 04h10
# ============================================================================

# ─── Paramètres d'environnement ───
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME=/home/alan

# ─── Pages individuelles (une par jour, 5 min d'intervalle) ───

# 22h00 — Tocsin
0 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh tocsin >> /home/alan/SITE/CRON/logs/tocsin-$(date +\%Y-\%m-\%d).log 2>&1

# 22h05 — Géopolitique Profonde
5 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh geopolitique-profonde >> /home/alan/SITE/CRON/logs/geopolitique-profonde-$(date +\%Y-\%m-\%d).log 2>&1

# 22h10 — TV Libertés
10 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh tv-libertes >> /home/alan/SITE/CRON/logs/tv-libertes-$(date +\%Y-\%m-\%d).log 2>&1

# 22h15 — Radio Courtoisie
15 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh radio-courtoisie >> /home/alan/SITE/CRON/logs/radio-courtoisie-$(date +\%Y-\%m-\%d).log 2>&1

# 22h20 — Brochu TV
20 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh brochu-tv >> /home/alan/SITE/CRON/logs/brochu-tv-$(date +\%Y-\%m-\%d).log 2>&1

# 22h25 — François Asselineau
25 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh asselineau >> /home/alan/SITE/CRON/logs/asselineau-$(date +\%Y-\%m-\%d).log 2>&1

# 22h30 — Idriss Aberkane
30 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh idriss-aberkane >> /home/alan/SITE/CRON/logs/idriss-aberkane-$(date +\%Y-\%m-\%d).log 2>&1

# 22h35 — Jacques Baud
35 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh jacques-baud >> /home/alan/SITE/CRON/logs/jacques-baud-$(date +\%Y-\%m-\%d).log 2>&1

# 22h40 — Caroline Galactéros
40 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh caroline-galacteros >> /home/alan/SITE/CRON/logs/caroline-galacteros-$(date +\%Y-\%m-\%d).log 2>&1

# 22h45 — Alexis Cossette
45 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh alexis-cossette >> /home/alan/SITE/CRON/logs/alexis-cossette-$(date +\%Y-\%m-\%d).log 2>&1

# 22h50 — Dieudonné
50 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh dieudonne >> /home/alan/SITE/CRON/logs/dieudonne-$(date +\%Y-\%m-\%d).log 2>&1

# 22h55 — Pierre Jovanovic
55 22 * * * cd /home/alan/SITE/CRON && ./update-all.sh pierre-jovanovic >> /home/alan/SITE/CRON/logs/pierre-jovanovic-$(date +\%Y-\%m-\%d).log 2>&1

# 23h00 — Xavier Moreau
0 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh xavier-moreau >> /home/alan/SITE/CRON/logs/xavier-moreau-$(date +\%Y-\%m-\%d).log 2>&1

# 23h05 — Xavier Poussard
5 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh xavier-poussard >> /home/alan/SITE/CRON/logs/xavier-poussard-$(date +\%Y-\%m-\%d).log 2>&1

# 23h10 — Florian Philippot
10 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh florian-philippot >> /home/alan/SITE/CRON/logs/florian-philippot-$(date +\%Y-\%m-\%d).log 2>&1

# 23h15 — Alexis Poulin
15 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh alexis-poulin >> /home/alan/SITE/CRON/logs/alexis-poulin-$(date +\%Y-\%m-\%d).log 2>&1

# 23h20 — Alain Soral
20 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh alain-soral >> /home/alan/SITE/CRON/logs/alain-soral-$(date +\%Y-\%m-\%d).log 2>&1

# 23h25 — Nicolas Vidal
25 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh nicolas-vidal >> /home/alan/SITE/CRON/logs/nicolas-vidal-$(date +\%Y-\%m-\%d).log 2>&1

# 23h30 — Covid-19
30 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh covid-19 >> /home/alan/SITE/CRON/logs/covid-19-$(date +\%Y-\%m-\%d).log 2>&1

# 23h35 — Pierre Chaillot
35 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh pierre-chaillot >> /home/alan/SITE/CRON/logs/pierre-chaillot-$(date +\%Y-\%m-\%d).log 2>&1

# 23h40 — Affaire Epstein
40 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh epstein >> /home/alan/SITE/CRON/logs/epstein-$(date +\%Y-\%m-\%d).log 2>&1

# 23h45 — Affaire Brigitte
45 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh affaire-brigitte >> /home/alan/SITE/CRON/logs/affaire-brigitte-$(date +\%Y-\%m-\%d).log 2>&1

# 23h50 — Youssef Hindi
50 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh youssef-hindi >> /home/alan/SITE/CRON/logs/youssef-hindi-$(date +\%Y-\%m-\%d).log 2>&1

# 23h55 — Nexus
55 23 * * * cd /home/alan/SITE/CRON && ./update-all.sh nexus >> /home/alan/SITE/CRON/logs/nexus-$(date +\%Y-\%m-\%d).log 2>&1

# 00h00 — Le Média en 442
0 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh le-media-en-442 >> /home/alan/SITE/CRON/logs/le-media-en-442-$(date +\%Y-\%m-\%d).log 2>&1

# 00h05 — J'suis pas content TV
5 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh jsuispascontent-tv >> /home/alan/SITE/CRON/logs/jsuispascontent-tv-$(date +\%Y-\%m-\%d).log 2>&1

# 00h10 — ODC TV
10 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh odc-tv >> /home/alan/SITE/CRON/logs/odc-tv-$(date +\%Y-\%m-\%d).log 2>&1

# 00h15 — Aldo Sterone
15 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh aldo-sterone >> /home/alan/SITE/CRON/logs/aldo-sterone-$(date +\%Y-\%m-\%d).log 2>&1

# 00h20 — Béatrice Rosen
20 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh beatrice-rosen >> /home/alan/SITE/CRON/logs/beatrice-rosen-$(date +\%Y-\%m-\%d).log 2>&1

# 00h25 — Omerta
25 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh omerta >> /home/alan/SITE/CRON/logs/omerta-$(date +\%Y-\%m-\%d).log 2>&1

# 00h30 — Canard Réfractaire
30 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh canard-refractaire >> /home/alan/SITE/CRON/logs/canard-refractaire-$(date +\%Y-\%m-\%d).log 2>&1

# 00h35 — Sylvain Ferreira
35 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh sylvain-ferreira >> /home/alan/SITE/CRON/logs/sylvain-ferreira-$(date +\%Y-\%m-\%d).log 2>&1

# 00h40 — Campagnol TVL
40 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh campagnol-tvl >> /home/alan/SITE/CRON/logs/campagnol-tvl-$(date +\%Y-\%m-\%d).log 2>&1

# 00h45 — Louis Fouché
45 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh louis-fouche >> /home/alan/SITE/CRON/logs/louis-fouche-$(date +\%Y-\%m-\%d).log 2>&1

# 00h50 — Dialogue Franco-Russe
50 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh dialogue-franco-russe >> /home/alan/SITE/CRON/logs/dialogue-franco-russe-$(date +\%Y-\%m-\%d).log 2>&1

# 00h55 — Nicolas Bouvier
55 0 * * * cd /home/alan/SITE/CRON && ./update-all.sh nicolas-bouvier >> /home/alan/SITE/CRON/logs/nicolas-bouvier-$(date +\%Y-\%m-\%d).log 2>&1

# 01h00 — FranceSoir
0 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh france-soir >> /home/alan/SITE/CRON/logs/france-soir-$(date +\%Y-\%m-\%d).log 2>&1

# 01h05 — Égalité et Réconciliation
5 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh egalite-et-reconciliation >> /home/alan/SITE/CRON/logs/egalite-et-reconciliation-$(date +\%Y-\%m-\%d).log 2>&1

# 01h10 — John - Point de Rupture
10 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh john-point-de-rupture >> /home/alan/SITE/CRON/logs/john-point-de-rupture-$(date +\%Y-\%m-\%d).log 2>&1

# 01h15 — Jérémie Mercier
15 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh jeremie-mercier >> /home/alan/SITE/CRON/logs/jeremie-mercier-$(date +\%Y-\%m-\%d).log 2>&1

# 01h20 — KateTV
20 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh kate-tv >> /home/alan/SITE/CRON/logs/kate-tv-$(date +\%Y-\%m-\%d).log 2>&1

# 01h25 — Profession Gendarme
25 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh profession-gendarme >> /home/alan/SITE/CRON/logs/profession-gendarme-$(date +\%Y-\%m-\%d).log 2>&1

# 01h30 — Trouble Fait
30 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh trouble-fait >> /home/alan/SITE/CRON/logs/trouble-fait-$(date +\%Y-\%m-\%d).log 2>&1

# 01h35 — Réseau International
35 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh reseau-international >> /home/alan/SITE/CRON/logs/reseau-international-$(date +\%Y-\%m-\%d).log 2>&1

# 01h40 — Guerre Israël-USA-Iran
40 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh guerre-israel-usa-iran >> /home/alan/SITE/CRON/logs/guerre-israel-usa-iran-$(date +\%Y-\%m-\%d).log 2>&1

# 01h45 — Guerre Ukraine-OTAN-Russie
45 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh guerre-ukraine-otan-russie >> /home/alan/SITE/CRON/logs/guerre-ukraine-otan-russie-$(date +\%Y-\%m-\%d).log 2>&1

# 01h50 — Censure réseaux sociaux
50 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh censure-reseaux-sociaux >> /home/alan/SITE/CRON/logs/censure-reseaux-sociaux-$(date +\%Y-\%m-\%d).log 2>&1

# 01h55 — StratPol
55 1 * * * cd /home/alan/SITE/CRON && ./update-all.sh stratpol >> /home/alan/SITE/CRON/logs/stratpol-$(date +\%Y-\%m-\%d).log 2>&1

# 02h00 — Juste Milieu
0 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh juste-milieu >> /home/alan/SITE/CRON/logs/juste-milieu-$(date +\%Y-\%m-\%d).log 2>&1

# 02h05 — Praxis
5 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh praxis >> /home/alan/SITE/CRON/logs/praxis-$(date +\%Y-\%m-\%d).log 2>&1

# 02h10 — Fréquence Populaire
10 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh frequence-populaire >> /home/alan/SITE/CRON/logs/frequence-populaire-$(date +\%Y-\%m-\%d).log 2>&1

# 02h15 — Frontières
15 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh frontieres-media >> /home/alan/SITE/CRON/logs/frontieres-media-$(date +\%Y-\%m-\%d).log 2>&1

# 02h20 — Réinformation sur le monde
20 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh reinformation-sur-le-monde >> /home/alan/SITE/CRON/logs/reinformation-sur-le-monde-$(date +\%Y-\%m-\%d).log 2>&1

# 02h25 — Docteur Alwest
25 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh docteur-allwest >> /home/alan/SITE/CRON/logs/docteur-allwest-$(date +\%Y-\%m-\%d).log 2>&1

# 02h30 — RT France
30 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh rtfrance-tv >> /home/alan/SITE/CRON/logs/rtfrance-tv-$(date +\%Y-\%m-\%d).log 2>&1

# 02h35 — Élucid
35 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh elucid-media >> /home/alan/SITE/CRON/logs/elucid-media-$(date +\%Y-\%m-\%d).log 2>&1

# 02h40 — Le Monde Moderne
40 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh le-monde-moderne >> /home/alan/SITE/CRON/logs/le-monde-moderne-$(date +\%Y-\%m-\%d).log 2>&1

# 02h45 — Louis de Dreslincourt
45 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh louis-de-dreslincourt >> /home/alan/SITE/CRON/logs/louis-de-dreslincourt-$(date +\%Y-\%m-\%d).log 2>&1

# 02h50 — Antipresse
50 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh antipresse >> /home/alan/SITE/CRON/logs/antipresse-$(date +\%Y-\%m-\%d).log 2>&1

# 02h55 — CHAQUE JOUR SUR TERRE
55 2 * * * cd /home/alan/SITE/CRON && ./update-all.sh chaque-jour-sur-terre >> /home/alan/SITE/CRON/logs/chaque-jour-sur-terre-$(date +\%Y-\%m-\%d).log 2>&1

# 03h00 — Candace Owens En Français
0 3 * * * cd /home/alan/SITE/CRON && ./update-all.sh candace-owens-en-francais >> /home/alan/SITE/CRON/logs/candace-owens-en-francais-$(date +\%Y-\%m-\%d).log 2>&1

# 03h05 — Tatiana Ventôse
5 3 * * * cd /home/alan/SITE/CRON && ./update-all.sh tatiana-ventose >> /home/alan/SITE/CRON/logs/tatiana-ventose-$(date +\%Y-\%m-\%d).log 2>&1

# 03h10 — Boulevard Voltaire
10 3 * * * cd /home/alan/SITE/CRON && ./update-all.sh boulevard-voltaire >> /home/alan/SITE/CRON/logs/boulevard-voltaire-$(date +\%Y-\%m-\%d).log 2>&1

# ─── Transfert FTP ───
# 04h00 — Upload complet vers OVH
0 4 * * * cd /home/alan/SITE && bash FTP-CRON/upload.sh >> /home/alan/SITE/CRON/logs/ftp-upload-$(date +\%Y-\%m-\%d).log 2>&1

# ─── Sauvegarde quotidienne ───
# 04h10 — Sauvegarde zip de /home/alan/SITE vers /home/alan/SAUVEGARDE-RE-INFO-FR
10 4 * * * /home/alan/SITE/CRON/backup-site.sh >> /home/alan/SITE/CRON/logs/backup-$(date +\%Y-\%m-\%d).log 2>&1

# ─── Flash d'actualité (page d'accueil) ───
# Toutes les heures entre 5h et 21h : recherche + synthèse + enregistrement
# + pause 1 minute + transfert FTP (put sans option)
0 5-21 * * * cd /home/alan/SITE/CRON && ./flash-actu.sh >> /home/alan/SITE/CRON/logs/flash-actu-$(date +\%Y-\%m-\%d).log 2>&1

# ─── Nettoyage /tmp (fichiers temporaires opencode .so/.node) ───
# Tous les jours à 04h30 : supprime les fichiers cachés de plus de 24h
30 4 * * * find /tmp -maxdepth 1 -name ".*" -type f -mtime +1 -delete >> /home/alan/SITE/CRON/logs/tmp-clean-$(date +\%Y-\%m-\%d).log 2>&1

# ─── Purge /tmp/opencode (pages YouTube téléchargées par les agents) ───
# Tous les jours à 04h35 : supprime les fichiers .html/.xml de plus de 24h
# (les agents doivent TOUJOURS retélécharger, jamais réutiliser un fichier existant)
35 4 * * * find /tmp/opencode -maxdepth 1 \( -name "*.html" -o -name "*.xml" \) -type f -mtime +1 -delete >> /home/alan/SITE/CRON/logs/tmp-clean-$(date +\%Y-\%m-\%d).log 2>&1

# ─── Purge des logs de mise à jour (> 3 jours) ───
# Tous les jours à 04h40 : supprime les logs de pages de plus de 3 jours
# (maj.log, rapport-quotidien.log et flash-actu.log sont conservés)
40 4 * * * find /home/alan/SITE/CRON/logs -maxdepth 1 -type f -name "*.log" -mtime +3 ! -name "maj.log" ! -name "rapport-quotidien.log" ! -name "flash-actu.log" -delete >> /home/alan/SITE/CRON/logs/tmp-clean-$(date +\%Y-\%m-\%d).log 2>&1
