Scheduled Cron Job Automation
Description
This automation demonstrates scheduled task execution using cron expressions. The automation runs on a defined schedule to trigger batch processes, regular maintenance tasks, or recurring business operations. This pattern is essential for implementing time-based workflows such as daily reports, subscription billing runs, data synchronization, or cleanup tasks. The cron job includes timeout configuration to prevent long-running processes from blocking the system.
Use Case
Used in a subscription management system to trigger daily donation subscription processing. The automation runs every weekday evening at 6 PM to process pending subscription charges, generate invoices, and update payment statuses. This ensures consistent billing cycles and automated revenue collection without manual intervention.
Key Features
- Cron expression for flexible scheduling
- Timeout configuration for process control
- Weekday-only execution (Monday-Thursday)
- Business process automation
- Time-zone aware scheduling
- Error handling through timeout limits
JSON Definition
{
"key": "schedule_donation_subscription_run",
"name": "schedule donation subscription run",
"entityKey": "subscription_run",
"app": "sub",
"triggerType": "cronJob",
"triggerParams": {
"cronExpression": "0 18 * * 0-4",
"timeoutMs": 30000
},
"actions": [
{
"name": "Kick off subscriptions run",
"key": "kick_off_subscriptions_run",
"actionTypeKey": "handle_subscription_run",
"params": {
"type": "Donation"
}
}
]
}
Notes
- Cron expression format: minute hour day month weekday
0 18 * * 0-4runs at 18:00 (6 PM) Sunday through Thursday- Timeout is set to 30 seconds (30000ms) to prevent hanging processes
- The automation can trigger complex batch processing workflows
- Different subscription types can have separate schedules
- Cron jobs run in the server's configured timezone
- Failed executions are logged for monitoring and retry