fix cron for epg
Build and Push Docker Images / build-and-push (push) Successful in 1m45s

This commit is contained in:
2026-05-24 13:42:04 +02:00
parent 019e1054b9
commit 6b63abc2af
2 changed files with 18 additions and 4 deletions
+16 -2
View File
@@ -69,8 +69,22 @@ fi
if [ -n "$CRON_SCHEDULE" ] && [ -n "$SITES" ]; then
echo "Setting up cron job with schedule: $CRON_SCHEDULE"
pm2 start --name epg-grabber /app/entrypoint.sh --no-autorestart --cron-restart="$CRON_SCHEDULE" -- grab
pm2 logs epg-grabber &
# Cron runs with a minimal env — bake grab-related vars into a wrapper script.
{
echo '#!/bin/sh'
echo 'cd /app'
for var in SITES OUTPUT MAX_CONNECTIONS DAYS TIMEOUT DELAY LANG PROXY GZIP JSON CURL; do
eval "val=\$$var"
if [ -n "$val" ]; then
printf "export %s='%s'\n" "$var" "$(printf '%s' "$val" | sed "s/'/'\\\\''/g")"
fi
done
echo 'exec /app/entrypoint.sh grab'
} >/app/run-grab.sh
chmod +x /app/run-grab.sh
echo "$CRON_SCHEDULE /app/run-grab.sh >> /proc/1/fd/1 2>&1" >/etc/crontabs/root
chmod 600 /etc/crontabs/root
crond -b -l 2
fi
echo "Starting server on port 3000 to serve EPG files from /app/guides"