#!/bin/bash # ============================================================================== # SIRO Maps — Crontab Installer Script # ============================================================================== # Installs all scheduled jobs from crontab.txt into the current user's crontab. # Ensures all target scripts have executable permissions and directories exist. # ============================================================================== set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" APP_DIR="$(dirname "$SCRIPT_DIR")" CRON_FILE="${SCRIPT_DIR}/crontab.txt" echo "🔧 Installing SIRO Maps Crontab..." echo "📂 App Directory: $APP_DIR" echo "📄 Crontab File: $CRON_FILE" # 1. Ensure required directories exist mkdir -p "${APP_DIR}/logs" mkdir -p "${APP_DIR}/backups/db" # 2. Make all scripts executable chmod +x "${APP_DIR}/scripts/"*.sh 2>/dev/null || true # 3. Load crontab crontab "$CRON_FILE" echo "✅ Crontab successfully installed!" echo "📋 Active Crontab Entries:" echo "------------------------------------------------------------------------------" crontab -l echo "------------------------------------------------------------------------------"