Scheduled Tasks¶
Management of scheduled tasks and cron jobs in calServer V2.
Overview¶
The CronJobController manages scheduled tasks (cron jobs) that are automatically executed at defined intervals. This includes maintenance tasks, notifications, and data synchronization.
Cron Job Management¶
Overview¶
Under Admin > Scheduled Tasks, all configured cron jobs are displayed:
| Field | Description |
|---|---|
| Name | Task name |
| Command | Artisan command to execute |
| Schedule | Cron expression (e.g. */5 * * * *) |
| Last Run | Time of last execution |
| Status | Active / Inactive / Failed |
Create New Cron Job¶
- Navigate to Admin > Scheduled Tasks
- Click New Cron Job
- Configure the task:
| Field | Example |
|---|---|
| Name | Calibration reminders |
| Command | calibration:send-reminders |
| Schedule | 0 8 * * 1 (Mondays at 8:00) |
| Active | Yes |
- Save the configuration
Preconfigured Tasks¶
Default cron jobs
The following tasks are preconfigured during installation:
| Task | Schedule | Description |
|---|---|---|
| Calibration reminders | Daily 8:00 | Notification for due calibrations |
| Backup | Daily 2:00 | Automatic database backup |
| Log cleanup | Weekly | Remove old log entries |
| Synchronization | Every 5 min | V1/V2 data reconciliation |
| Queue monitoring | Every 10 min | Check queue worker status |
| Certificate check | Daily | Check SSL certificates for expiration |
Cron Expressions¶
* * * * *
| | | | |
| | | | +-- Day of week (0-7, 0 and 7 = Sunday)
| | | +---- Month (1-12)
| | +------ Day (1-31)
| +-------- Hour (0-23)
+---------- Minute (0-59)
| Expression | Meaning |
|---|---|
* * * * * |
Every minute |
0 * * * * |
Every hour |
0 8 * * * |
Daily at 8:00 |
0 8 * * 1 |
Mondays at 8:00 |
0 2 1 * * |
1st of each month at 2:00 |
Restart Cron Job¶
Restart after changes
After changes to cron jobs, the scheduler must be restarted.
# Restart scheduler
docker compose exec app php artisan schedule:clear-cache
# Manually run scheduler (for testing)
docker compose exec app php artisan schedule:run
Run Individual Task Manually¶
Monitoring¶
The status of all cron jobs is displayed in the admin interface:
- Green dot: Last run successful
- Red dot: Last run failed
- Gray dot: Never executed
Failed jobs
For failed jobs, a notification is sent to the administrator. Error details are available in the execution log.
Permissions¶
Management of scheduled tasks requires the admin_settings operation.