Cron Jobs
Schedule automated tasks for your web applications. Regular script execution, cache cleanup, e-mail sending, and more.
Overview
| Feature | Details |
|---|---|
| Syntax | Standard cron format |
| Minute Precision | Every minute to once per year |
| Logging | Output to log |
| Notification on error | |
| Enable/Disable | Yes |
Cron Format
Basic Syntax
* * * * * command
│ │ │ │ │
│ │ │ │ └── Day of week (0-7, 0 and 7 = Sunday)
│ │ │ └──── Month (1-12)
│ │ └────── Day of month (1-31)
│ └──────── Hour (0-23)
└─────────── Minute (0-59)Examples
| Cron | Meaning |
|---|---|
* * * * * | Every minute |
0 * * * * | Every hour |
0 0 * * * | Every day at midnight |
0 2 * * * | Every day at 2:00 AM |
0 0 * * 0 | Every Sunday at midnight |
0 0 1 * * | First day of every month |
*/15 * * * * | Every 15 minutes |
0 9-17 * * * | Every hour 9 AM-5 PM |
Creating Cron Job
Step 1 — Open Cron Section
- Log in to CoreSynth Dashboard
- Go to Web Hosting
- Select your hosting package
- Click Cron in sidebar
Step 2 — New Job
- Click Create Job
- Fill in:
| Field | Description |
|---|---|
| Minute | 0-59 or * |
| Hour | 0-23 or * |
| Day of Month | 1-31 or * |
| Month | 1-12 or * |
| Day of Week | 0-7 or * |
| Command | Path to script |
- Click Create
Command Examples
# PHP script
/usr/bin/php /home/user/domains/example.com/public_html/cron.php
# PHP script with parameters
/usr/bin/php /home/user/domains/example.com/public_html/cron.php --task=cleanup
# Wget for HTTP call
/usr/bin/wget -q -O /dev/null https://example.com/cron.php
# Curl for HTTP call
/usr/bin/curl -s https://example.com/cron.php > /dev/null
# Script in home directory
/home/user/scripts/backup.shTip: Use absolute paths for reliability.
Managing Jobs
Enable/Disable Job
- In job list click Enable or Disable
- Disabled job won’t run but stays in list
Editing Job
- In job list click Edit
- Change time or command
- Click Save
Deleting Job
- In job list click Delete
- Confirm deletion
Common Use Cases
WordPress Cron
# WordPress scheduled tasks
*/5 * * * * /usr/bin/php /home/user/domains/example.com/public_html/wp-cron.phpRecommendation: Set
define('DISABLE_WP_CRON', true);inwp-config.php.
Laravel Scheduler
# Laravel scheduler
* * * * * /usr/bin/php /home/user/domains/example.com/public_html/artisan schedule:run >> /dev/null 2>&1Cache Cleanup
# Clear Laravel cache daily
0 3 * * * /usr/bin/php /home/user/domains/example.com/public_html/artisan cache:clearDatabase Backups
# MySQL backup daily
0 2 * * * /usr/bin/mysqldump -u user -p'password' database > /home/user/backups/db_$(date +\%Y\%m\%d).sqlSending E-mails
# Send newsletter weekly
0 9 * * 1 /usr/bin/php /home/user/domains/example.com/public_html/send-newsletter.phpLogging
Output to Log
# Output to log file
* * * * * /usr/bin/php /home/user/script.php >> /home/user/logs/cron.log 2>&1Log Only Errors
# Log only errors
* * * * * /usr/bin/php /home/user/script.php > /dev/null 2>> /home/user/logs/cron-error.logSuppress Output
# Suppress all output
* * * * * /usr/bin/php /home/user/script.php > /dev/null 2>&1Troubleshooting
Job Not Running
Cause: Wrong time or disabled.
Solution:
- Check if job is enabled
- Check timing (minute, hour, etc.)
- Check output log
”Command Not Found” Error
Cause: Wrong command path.
Solution:
- Use absolute path:
/usr/bin/phpinstead ofphp - Find path:
which php - Use found path
”Permission Denied” Error
Cause: Script lacks execute permission.
Solution:
- Set permission:
chmod +x script.sh - For PHP scripts use
php /path/to/script.php - Check file owner
Script Works Manually Not in Cron
Cause: Different environment.
Solution:
- Set PATH in crontab:
PATH=/usr/local/bin:/usr/bin:/bin - Use absolute paths
- Set working directory:
cd /home/user/domains/example.com/public_html && /usr/bin/php script.php
Security Recommendations
- Use absolute paths
- Log errors to files
- Set reasonable intervals (not every minute)
- Lock sensitive scripts
- Use
.htaccessfor HTTP crons:<Files "cron.php"> Order Allow,Deny Allow from localhost Deny from all </Files>
Next Steps
- Web Hosting — Hosting overview
- Databases — Configure MySQL
- FTP — Upload files
Need help? Open a support ticket or ask Alex in your dashboard.
Last updated on