#!/bin/sh set -e echo "Email Reports Container Starting..." echo "Current time: $(date)" echo "Timezone: $(date +%Z)" # Verify crontab is configured echo "" echo "Cron schedule:" crontab -l || echo "Warning: No crontab found" # Create log file if it doesn't exist touch /var/log/cron.log chmod 666 /var/log/cron.log # Create email log if it doesn't exist touch /app/email.log chmod 666 /app/email.log # Test PHP echo "" echo "Testing PHP..." php -v || { echo "PHP test failed"; exit 1; } # Test database connectivity (optional - won't fail if not reachable) echo "" echo "Environment variables loaded:" echo " DB_HOST_CREW: ${DB_HOST_CREW:-not set}" echo " DB_HOST_MERCHBAY: ${DB_HOST_MERCHBAY:-not set}" echo " SMTP_HOST: ${SMTP_HOST:-not set}" # Start crond in foreground echo "" echo "Starting cron daemon in foreground..." echo "Logs will be written to:" echo " - Cron output: /var/log/cron.log" echo " - Email logs: /app/email.log" echo "" exec crond -f -l 2