···
4
+
echo "Starting Kagi News RSS Aggregator..."
5
+
echo "========================================="
7
+
# Load environment variables if .env file exists
8
+
if [ -f /app/.env ]; then
9
+
echo "Loading environment variables from .env"
10
+
export $(grep -v '^#' /app/.env | xargs)
13
+
# Validate required environment variables
14
+
if [ -z "$AGGREGATOR_HANDLE" ] || [ -z "$AGGREGATOR_PASSWORD" ]; then
15
+
echo "ERROR: Missing required environment variables!"
16
+
echo "Please set AGGREGATOR_HANDLE and AGGREGATOR_PASSWORD"
20
+
echo "Aggregator Handle: $AGGREGATOR_HANDLE"
21
+
echo "Cron schedule loaded from /etc/cron.d/kagi-aggregator"
23
+
# Start cron in the background
24
+
echo "Starting cron daemon..."
27
+
# Optional: Run aggregator immediately on startup (for testing)
28
+
if [ "$RUN_ON_STARTUP" = "true" ]; then
29
+
echo "Running aggregator immediately (RUN_ON_STARTUP=true)..."
30
+
cd /app && python -m src.main
33
+
echo "========================================="
34
+
echo "Kagi News Aggregator is running!"
35
+
echo "Cron schedule: Daily at 1 PM UTC"
36
+
echo "Logs will appear below:"
37
+
echo "========================================="
40
+
# Execute the command passed to docker run (defaults to tail -f /var/log/cron.log)