Cron Scheduler
Automate recurring tasks and scheduled maintenance in PteroCA.
Cron Job Schedule
The pteroca:cron:schedule command is a critical system command designed to execute other scheduled commands at defined intervals. It serves as a facade, running specific system maintenance commands that ensure the smooth operation of the panel. This command is intended to be added to a crontab (or a crontab alternative) to automate recurring tasks.
Command:
pteroca:cron:scheduleAlias:
app:cron-job-schedule(deprecated, removed in v1.0.0)
For detailed instructions on adding this command to your crontab, refer to the Crontab Configuration section in the documentation.
Examples
# Recommended (v0.6+)
docker exec pteroca_web_dev php bin/console pteroca:cron:schedule
# Deprecated (still works until v1.0.0)
docker exec pteroca_web_dev php bin/console app:cron-job-scheduleScheduled Commands
Commands executed by the scheduler:
Every Minute
pteroca:server:suspend-unpaid- Suspends servers for users with unpaid balancespteroca:plugin:cron:run- Executes due plugin cron tasks
Hourly
pteroca:system:cleanup-tokens- Deletes expired purchase tokenspteroca:server:delete-inactive- Deletes inactive servers (if enabled)
Daily/As Configured
pteroca:system:cleanup-logs- Deletes old logs (if enabled)
Automating with Crontab
To ensure this command runs automatically, add it to your crontab (or an alternative scheduling system). For example, to run this command every minute, use the following crontab configuration:
Important: Make sure to update your crontab to use pteroca:cron:schedule before upgrading to v1.0.0!
Docker Environment
If you're running PteroCA in Docker, add the cron command to your host's crontab:
Or set up a cron container in your docker-compose.yml:
Setting Up Crontab
Step 1: Open Crontab Editor
Step 2: Add the Cron Entry
Add one of the following lines depending on your setup:
Standalone Installation:
Docker Installation:
Step 3: Save and Exit
The cron daemon will automatically pick up the new schedule.
Verifying Cron Setup
Check Crontab
Check System Logs
Test Manually
Troubleshooting
Cron Not Running
Check cron service:
Restart cron service:
Commands Not Executing
Check file permissions:
Make console executable:
Plugin Cron Tasks Not Running
List plugin cron tasks:
Check if plugins are enabled:
Manually run plugin cron tasks:
Best Practices
Use absolute paths - Always use full paths to PHP and the console script
Redirect output - Use
>> /dev/null 2>&1to suppress outputTest first - Run commands manually before adding to crontab
Monitor logs - Check system logs and PteroCA logs regularly
Update commands - Switch to new
pteroca:*namespace before v1.0.0
Related Guides
CLI Commands Overview - Command reference home
Server Management Commands - Automated server management
System Commands - Automated maintenance
Plugin Commands - Plugin cron tasks
Crontab Configuration - Detailed setup guide
Last updated