pounce/backend/scripts/setup_cron.sh
yves.gugger a42435c24d
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
Premium service implementation & Tone of Voice consistency
🚀 PREMIUM DATA COLLECTOR:
- New script: backend/scripts/premium_data_collector.py
- Automated TLD price collection with quality scoring
- Automated auction scraping with validation
- Data quality reports (JSON + console output)
- Premium-ready score calculation (target: 80+)

 CRON AUTOMATION:
- New script: backend/scripts/setup_cron.sh
- TLD prices: Every 6 hours
- Auctions: Every 2 hours
- Quality reports: Daily at 1:00 AM

👤 ADMIN PRIVILEGES:
- guggeryves@hotmail.com always admin + verified
- Auto-creates Tycoon subscription for admin
- Works for OAuth and regular registration

🎯 TONE OF VOICE FIXES:
- 'Get Started Free' → 'Join the Hunt'
- 'Blog' → 'Briefings' (Footer + Pages)
- 'Loading...' → 'Acquiring targets...'
- 'Back to Blog' → 'Back to Briefings'
- Analysis report: TONE_OF_VOICE_ANALYSIS.md (85% consistent)
2025-12-10 09:22:29 +01:00

133 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# 🚀 POUNCE AUTOMATED DATA COLLECTION - CRON SETUP
# =============================================================================
#
# This script sets up automated data collection for premium service.
#
# Schedule:
# - TLD Prices: Every 6 hours (0:00, 6:00, 12:00, 18:00)
# - Auctions: Every 2 hours
# - Quality Report: Daily at 1:00 AM
#
# Usage:
# ./setup_cron.sh # Install cron jobs
# ./setup_cron.sh --remove # Remove cron jobs
# ./setup_cron.sh --status # Show current cron jobs
#
# =============================================================================
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
PYTHON_PATH="${PROJECT_DIR}/.venv/bin/python"
COLLECTOR_SCRIPT="${SCRIPT_DIR}/premium_data_collector.py"
LOG_DIR="${PROJECT_DIR}/logs"
# Ensure log directory exists
mkdir -p "$LOG_DIR"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
print_status() {
echo -e "${GREEN}[✓]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[!]${NC} $1"
}
print_error() {
echo -e "${RED}[✗]${NC} $1"
}
# Cron job definitions
CRON_MARKER="# POUNCE_DATA_COLLECTOR"
TLD_CRON="0 */6 * * * cd ${PROJECT_DIR} && ${PYTHON_PATH} ${COLLECTOR_SCRIPT} --tld --quiet >> ${LOG_DIR}/tld_collection.log 2>&1 ${CRON_MARKER}"
AUCTION_CRON="0 */2 * * * cd ${PROJECT_DIR} && ${PYTHON_PATH} ${COLLECTOR_SCRIPT} --auctions --quiet >> ${LOG_DIR}/auction_collection.log 2>&1 ${CRON_MARKER}"
REPORT_CRON="0 1 * * * cd ${PROJECT_DIR} && ${PYTHON_PATH} ${COLLECTOR_SCRIPT} --report --quiet >> ${LOG_DIR}/quality_report.log 2>&1 ${CRON_MARKER}"
install_cron() {
echo "🚀 Installing Pounce Data Collection Cron Jobs..."
echo ""
# Check if Python environment exists
if [ ! -f "$PYTHON_PATH" ]; then
print_error "Python virtual environment not found at: $PYTHON_PATH"
echo "Please create it first: python -m venv .venv && .venv/bin/pip install -r requirements.txt"
exit 1
fi
# Check if collector script exists
if [ ! -f "$COLLECTOR_SCRIPT" ]; then
print_error "Collector script not found at: $COLLECTOR_SCRIPT"
exit 1
fi
# Remove existing Pounce cron jobs first
(crontab -l 2>/dev/null | grep -v "$CRON_MARKER") | crontab -
# Add new cron jobs
(crontab -l 2>/dev/null; echo "$TLD_CRON") | crontab -
(crontab -l 2>/dev/null; echo "$AUCTION_CRON") | crontab -
(crontab -l 2>/dev/null; echo "$REPORT_CRON") | crontab -
print_status "TLD Price Collection: Every 6 hours"
print_status "Auction Collection: Every 2 hours"
print_status "Quality Report: Daily at 1:00 AM"
echo ""
print_status "All cron jobs installed successfully!"
echo ""
echo "Log files will be written to: ${LOG_DIR}/"
echo ""
echo "To view current jobs: crontab -l"
echo "To remove jobs: $0 --remove"
}
remove_cron() {
echo "🗑️ Removing Pounce Data Collection Cron Jobs..."
(crontab -l 2>/dev/null | grep -v "$CRON_MARKER") | crontab -
print_status "All Pounce cron jobs removed."
}
show_status() {
echo "📋 Current Pounce Cron Jobs:"
echo ""
JOBS=$(crontab -l 2>/dev/null | grep "$CRON_MARKER" || true)
if [ -z "$JOBS" ]; then
print_warning "No Pounce cron jobs found."
echo ""
echo "Run '$0' to install them."
else
echo "$JOBS" | while read -r line; do
echo " $line"
done
echo ""
print_status "Jobs are active."
fi
}
# Main
case "${1:-}" in
--remove)
remove_cron
;;
--status)
show_status
;;
*)
install_cron
;;
esac