Configuring Cron Jobs
Quant Cloud provides comprehensive scheduled task management through cron jobs, allowing you to automate repetitive commands, maintenance tasks, and batch processing within your application environment. The cron job management interface is accessible through the “Manage Cron Jobs” section of your environment.
Managing Scheduled Tasks
The “Scheduled Tasks (Cron Jobs)” interface provides a comprehensive view of all automated tasks configured for your environment.
Cron Jobs Overview Table The main table displays essential information about each scheduled task:
- Name: Unique identifier for the cron job (e.g.,
process-cf-domains
,database-backup
) - State: Current status indicator showing
ENABLED
orDISABLED
- Schedule Info: Human-readable description of when the task runs
- Last Modified: Timestamp of the most recent configuration change
- Actions: Management options for each cron job
Available Actions Each cron job provides several management options:
- Edit (pencil icon): Modify the cron job configuration
- Delete (trash icon): Remove the cron job permanently
- View History (clock icon): Access detailed execution history and logs
Adding New Cron Jobs Click the “Add New Cron Job” button to create additional scheduled tasks for your environment.
Configuring Cron Jobs
The cron job configuration modal provides comprehensive options for defining scheduled tasks. Access this interface by clicking “Add New Cron Job” or editing an existing job.
Basic Configuration
Schedule Name (Required)
Provide a unique identifier for your cron job using letters, numbers, hyphens, underscores, and periods. Examples include process-cf-domains
, database-backup
, or nightly-cleanup
.
Description (Optional) Add a brief explanation of what the cron job accomplishes. This helps team members understand the task’s purpose and importance.
Schedule Configuration
Quick Schedule Options Use the Quick Schedule dropdown to select common scheduling patterns:
- Custom: Define your own schedule using the detailed controls below
- Every Minute: Runs continuously every minute
- Hourly: Executes at the top of each hour
- Daily: Runs once per day at a specified time
- Weekly: Executes once per week on a chosen day
- Monthly: Runs once per month on a specified date
Detailed Schedule Expression Configure precise timing using individual time components:
- Minutes: Specify exact minutes (0-59) or use
*
for every minute - Hours: Set specific hours (0-23) or use
*
for every hour - Day (Month): Choose specific days of the month (1-31)
- Month: Select particular months (1-12)
- Day (Week): Pick specific days of the week (0-6, where 0 = Sunday)
- Year: Set specific years or use
*
for every year
Generated Expression
The interface automatically generates the complete cron expression based on your selections, displaying it in the format: cron(*/3 * * * ? *)
with a human-readable interpretation like “Runs: every 3 minutes in year *”.
Execution Configuration
Command (Required) Specify the exact command and arguments to execute within the container. Examples:
php artisan quant:processCloudFrontDomains
npm run backup:database
python /app/scripts/cleanup.py --force
Target Container (Optional) For multi-container environments, select which container should execute the command. The dropdown lists all available containers in your environment. If unspecified, the command runs in the default container.
Enabled Status Use the “Job is enabled” checkbox to control whether the cron job actively runs according to its schedule. Disabled jobs remain configured but won’t execute until re-enabled.
Saving Configuration
After configuring all required fields, click “Save Changes” to create or update the cron job. The system will validate your configuration and begin scheduling the task according to your specified timing.
Best Practices
Command Design
- Ensure commands are idempotent (safe to run multiple times)
- Include proper error handling and logging within your scripts
- Use absolute paths for file references within commands
- Test commands manually in your container before scheduling
Scheduling Considerations
- All schedules operate in UTC time zone
- Resource-intensive tasks can be scheduled freely since they run in isolated temporary containers
- Consider dependencies between different cron jobs to prevent conflicts
- Use appropriate intervals based on your application’s needs and data processing requirements
Monitoring and Maintenance
- Regularly review cron job execution history for failures or performance issues
- Update job schedules as your application requirements evolve
- Disable or remove obsolete cron jobs to reduce unnecessary executions
- Monitor execution duration and success rates rather than resource impact on production