domovoy_bot/services/email_auditor/auto_sync_pipeline.sh

29 lines
1.3 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# -----------------------------------------------------------------------------
# DOMOVOY AI PIPELINE: MAIL -> PDF -> DRIVE -> TELEGRAM
# -----------------------------------------------------------------------------
BASE_DIR="/home/matrixhasyou/domovoy_bot"
BOT_PYTHON="python3" # Используем системный питон (там imap-tools)
GOOGLE_PYTHON="$BASE_DIR/venv-google/bin/python"
LOG_FILE="$BASE_DIR/services/email_auditor/pipeline.log"
echo "[$(date)] >>> СТАРТ ПАЙПЛАЙНА" >> $LOG_FILE
# 1. Запуск экспорта почты (mutt -> PDF)
echo "[$(date)] >>> Экспорт почты..." >> $LOG_FILE
cd $BASE_DIR
$BOT_PYTHON services/email_auditor/export_emails_v2.py >> $LOG_FILE 2>&1
# 2. Даем права на всякий случай
chmod +x /home/matrixhasyou/domovoy_drive_sync.py
# 3. Загрузка в Google Drive
echo "[$(date)] >>> Загрузка на Google Drive..." >> $LOG_FILE
$GOOGLE_PYTHON /home/matrixhasyou/domovoy_drive_sync.py "/home/matrixhasyou/domovoy_bot/services/email_auditor/exported_emails/TOTAL_ARCHIVE_2025-2026.pdf" >> $LOG_FILE 2>&1
if [ $? -eq 0 ]; then
echo "[$(date)] >>> УСПЕХ: Пайплайн завершен." >> $LOG_FILE
else
echo "[$(date)] >>> ОШИБКА в пайплайне." >> $LOG_FILE
fi