Skip to main content

Cron Jobs

Schedule recurring tasks and run serverless functions on a schedule. No infrastructure management required.

What are Cron Jobs?

Cron Jobs allow you to schedule functions to run at specific intervals (hourly, daily, weekly, etc.) or specific times. They run as serverless functions, so you only pay for execution time.

Key Features

  • Flexible Scheduling: Schedule jobs using cron syntax
  • Serverless: Pay only for execution time
  • Automatic Retries: Built-in retry logic for failed jobs
  • Monitoring: Track execution history and logs
  • Alerts: Get notified of job failures
  • Environment Variables: Secure configuration

Use Cases

  • Daily database backups
  • Periodic data cleanup
  • Scheduled reports and exports
  • Health checks and monitoring
  • Data synchronization
  • Cache warming
  • Newsletter sending

Cron Syntax

Schedule jobs using standard cron syntax:
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6)
│ │ │ │ │
* * * * *

Common Examples

  • 0 0 * * * - Run daily at midnight
  • 0 */6 * * * - Run every 6 hours
  • 0 9 * * 1 - Run every Monday at 9 AM
  • */15 * * * * - Run every 15 minutes

Getting Started

  1. Create a Cron Job from your dashboard
  2. Write your function code
  3. Set schedule using cron syntax
  4. Configure environment variables
  5. Deploy and monitor execution

Configuration Example

export default async function handler() {
  // Your scheduled task logic
  await performScheduledTask();
  
  return {
    statusCode: 200,
    body: 'Task completed successfully'
  };
}

Runtime Options

  • Node.js: JavaScript and TypeScript
  • Python: Python scripts and functions
  • Go: Compiled Go binaries
  • Docker: Custom containerized tasks

Monitoring

Track your cron jobs with:
  • Execution History: See all past runs
  • Success/Failure Rates: Monitor job health
  • Logs: View execution logs in real-time
  • Metrics: CPU time, memory usage, duration

Pricing

Cron Jobs are billed by:
  • Execution Time: Actual runtime of your function
  • Invocations: Number of times the job runs
  • Memory: Memory allocated per execution

Create Your First Cron Job

Get started with cron jobs