TrigRun
Use Cases

Schedule Database Backups

Trigger automated database backups on a cron schedule using TrigRun. Copy-paste API examples for PostgreSQL, MySQL, and MongoDB backup endpoints.

Trigger your database backup endpoint every night without managing crontab or servers. TrigRun calls your backup URL on schedule, retries on failure, and alerts you if anything goes wrong.

The problem

You have a backup endpoint (or a serverless function that runs pg_dump) and need it called reliably at 2 AM every night. Running a cron daemon means maintaining a server just for scheduling. If the server goes down, backups stop silently.

The TrigRun solution

SettingValue
Schedule0 2 * * * (daily at 2:00 AM)
MethodPOST
Timeout300 seconds (backups can be slow)
Retries3 attempts with exponential backoff

Create via API

curl -X POST https://api.trigrun.com/v1/jobs \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Nightly database backup",
    "kind": "cron",
    "schedule": {
      "cron": "0 2 * * *"
    },
    "request": {
      "url": "https://api.yourapp.com/admin/backup",
      "method": "POST",
      "headers": {
        "Authorization": "secret://backup-api-key",
        "Content-Type": "application/json"
      },
      "body": {
        "type": "full",
        "compress": true
      },
      "timeout_seconds": 300
    },
    "retry_policy": {
      "max_attempts": 3,
      "retry_on_statuses": [500, 502, 503, 504]
    }
  }'

Create via CLI

trigrun jobs create \
  --name "Nightly database backup" \
  --kind cron \
  --cron "0 2 * * *" \
  --url "https://api.yourapp.com/admin/backup" \
  --method POST \
  --header "Authorization: secret://backup-api-key" \
  --timeout 300 \
  --retries 3

Why TrigRun over crontab

  • No server to maintain — no VM running just to trigger a backup
  • Automatic retries — if your DB server is temporarily unreachable, TrigRun retries with backoff
  • Failure alerts — get notified via Slack, Discord, or email if the backup fails after all retries
  • Encrypted secrets — API keys stored in TrigRun's vault, never exposed in logs
  • Execution history — see every backup run with status, duration, and response for 30 days

Common variations

VariationScheduleExpression
Nightly at 2 AMEvery day0 2 * * *
Every 6 hoursFour times daily0 */6 * * *
Weekly Sunday nightOnce per week0 3 * * 0
First of every monthMonthly0 2 1 * *

On this page