Docker
Monitor containerized cron jobs by adding curl to your container and pinging from the entrypoint or crontab:
Dockerfile
FROM python:3.12-slim RUN apt-get update && apt-get install -y curl cron COPY crontab /etc/cron.d/app-cron RUN chmod 0644 /etc/cron.d/app-cron && crontab /etc/cron.d/app-cron CMD ["cron", "-f"]
crontab
*/5 * * * * /app/run-task.sh && curl -fsS https://watchcron.com/ping/your-uuid > /dev/null 2>&1
docker-compose.yml
services: worker: build: . environment: - WATCHCRON_PING_URL=https://watchcron.com/ping/your-uuid healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 30s timeout: 10s
Pass the ping URL as an environment variable so you can change it without rebuilding the image. Reference it in your scripts with
$WATCHCRON_PING_URL.