Cron Jobs
Background jobs run on scheduled intervals to handle SSL monitoring, notification delivery, and obligation recurrence. Configured via Vercel Cron or compatible scheduler.
Background Job Architecture
SSL Certificate Scan
Checks SSL/TLS certificates for all monitored domains and stores results.
0 */12 * * */api/cron/ssl-scanActions
- 1Retrieves all active domains from database
- 2Performs TLS handshake for each domain
- 3Parses certificate details (issuer, validity, SANs)
- 4Stores check results with status
- 5Creates notification events for expiring/failed certificates
Process Notifications
Processes queued notification events and sends them through configured connectors.
*/5 * * * */api/cron/process-notificationsActions
- 1Queries queued notification events
- 2Resolves notification routes for each event
- 3Sends via Email, Telegram, WhatsApp, or Webhook
- 4Updates delivery status
- 5Creates retry entries for failed deliveries
Retry Failed Notifications
Retries failed notification deliveries with exponential backoff.
*/5 * * * */api/cron/retriesActions
- 1Finds failed notifications eligible for retry
- 2Checks retry count (max 5 attempts)
- 3Applies exponential backoff delay
- 4Attempts redelivery
- 5Moves to dead letter after max retries
Generate Recurring Obligations
Creates next instances of recurring obligations when current ones are completed.
0 2 * * */api/cron/recurrenceActions
- 1Finds completed obligations with recurrence rules
- 2Calculates next due date based on recurrence type
- 3Creates new obligation instance
- 4Copies template configuration
- 5Assigns to same branch and owner
Vercel Configuration
Cron jobs are configured in vercel.json:
{
"crons": [
{
"path": "/api/cron/ssl-scan",
"schedule": "0 */12 * * *"
},
{
"path": "/api/cron/process-notifications",
"schedule": "*/5 * * * *"
},
{
"path": "/api/cron/retries",
"schedule": "*/5 * * * *"
},
{
"path": "/api/cron/recurrence",
"schedule": "0 2 * * *"
}
]
}Monitoring Cron Jobs
Monitor job execution in the Vercel dashboard under your project → Cron Jobs. Check for failed executions and review logs for errors.
Failed jobs are automatically retried based on the schedule, but persistent failures should be investigated promptly.
Self-Hosted Deployment
If not using Vercel, configure cron jobs using your server's scheduler:
# Linux crontab example
# SSL Scan every 12 hours
0 */12 * * * curl -s https://your-domain.com/api/cron/ssl-scan
# Process notifications every 5 minutes
*/5 * * * * curl -s https://your-domain.com/api/cron/process-notifications
# Retry failed every 5 minutes
*/5 * * * * curl -s https://your-domain.com/api/cron/retries
# Generate recurring daily at 2 AM
0 2 * * * curl -s https://your-domain.com/api/cron/recurrenceSecurity: Consider adding an internal API key check for cron endpoints when self-hosting to prevent unauthorized access.