Cron scheduler and task management with crontab
How to set up and manage scheduled tasks on a server using Cron.
Cron (Command Run ON) is a system for automatically running programs and scripts on a server at specified times.
Job syntax
Each cron job consists of six columns separated by spaces. The first five define the schedule, the sixth is the command to run:
* * * * * command to execute
| | | | |
| | | | └── Day of week (0–7, where both 0 and 7 = Sunday)
| | | └──── Month (1–12)
| | └────── Day (1–31)
| └──────── Hour (0–23)
└────────── Minute (0–59)
Each time field accepts:
- a specific value:
5 - a comma-separated list:
1,4,22 - a range:
4-9 - all possible values:
* - a step value:
*/3— every three units
Examples
Run a script every hour:
0 */1 * * * /usr/local/bin/php /home/login/html/cron.php
Run a script every three hours:
0 */3 * * * /usr/local/bin/php /home/login/html/cron.php
Run a script every three hours on Tuesdays and Fridays:
0 */3 * * 2,5 /usr/local/bin/php /home/login/html/cron.php
Run a script every Monday at 1:15 AM:
15 1 * * 1 /usr/local/bin/php /home/login/html/cron.php
Run a script on April 5th every year at 0:01 AM:
1 0 5 4 * /usr/local/bin/php /home/login/html/cron.php
Run a script on Friday the 13th at 13:13:
13 13 13 * 5 /usr/local/bin/php /home/login/html/cron.php
If a job is resource-intensive and only needs to run once a day, schedule it for off-peak hours — between 2 AM and 8 AM, when server load is at its lowest.
Our products and services
Managing jobs with crontab
Open the current user's crontab for editing:
crontab -e
Open alice's crontab:
crontab -u alice -e
List the current user's jobs:
crontab -l
List alice's jobs:
crontab -u alice -l
User crontab files are stored in /var/spool/cron/.
Help
If you have any questions or need assistance, please contact us through the ticket system — we're always here to help!