Cronjob: What It Is, What It's For, and How to Schedule One
Learn what a cronjob is used for, how to read its syntax, and how to schedule automated tasks in cPanel or DirectAdmin.
In this article
Introduction
A cronjob is a scheduled task that the server runs automatically. Its purpose is to automate repetitive processes without you having to open a page or run a command by hand.
You can use it to read email for a support ticket system, clean up temporary files, or trigger internal tasks for WordPress, Joomla, PrestaShop, and other applications.
What a cronjob is used for
A cronjob can run a task:
- Every few minutes.
- At a specific time.
- Once a day.
- On specific days of the week.
- On a specific day of each month.
Some common examples:
- Processing email for a ticketing system.
- Deleting temporary files once a day.
- Generating reports.
- Running maintenance tasks.
- Updating catalogs or data.
- Triggering backups.
- Processing an application’s queues.
Syntax of a cron task
A traditional cron expression uses five time fields followed by the command:
* * * * * command
| | | | |
| | | | +-- day of week (0-6)
| | | +---- month (1-12)
| | +------ day of month (1-31)
| +-------- hour (0-23)
+---------- minute (0-59)
Each asterisk means “any value.”
Examples
Run a task every day at 02:00:
0 2 * * * /path/to/command
Run it every 15 minutes:
*/15 * * * * /path/to/command
Run it on Mondays at 08:30:
30 8 * * 1 /path/to/command
Replace /path/to/command with the actual command provided by your application. Don’t copy an example without adapting the paths to your account.
How many cronjobs you can set up, and how often
On free hosting plans you get 1 cronjob, with a maximum frequency of once every 10 minutes.
On professional hosting plans you can run cron processes every 5 minutes or at a lower frequency than that.
Outside of those minimum limits, you can generally create as many cronjobs as your project needs, since most sites only use a few. If you need a very large number or particularly heavy tasks, it’s worth reviewing their impact on the server — many simultaneous processes can consume CPU, memory, disk, and database connections.
How to create a cronjob on your hosting
- Log in to DirectAdmin or cPanel.
- Open Cron Jobs, Cron Tasks, or a similar option.
- Pick a preset frequency or fill in the fields manually.
- Enter the command.
- Save the task.
- Check the result or review the generated log.
Useful tips
- Use absolute paths.
- Confirm which PHP version the script should run under.
- Test with a moderate frequency first.
- Log the output during setup.
- Avoid running the same task before the previous one finishes.
- Don’t publish keys or passwords in the command.
- Periodically check that the task is still working.
- Remove cronjobs for applications you no longer use.
To avoid constant emails with the process output, you can redirect it once you’ve confirmed it works. Don’t hide errors during the first tests.
Common issues
The task doesn’t run
Check the expression, paths, permissions, and command. A wrong space or character can completely change the schedule.
It runs at a different time
The server may use a different time zone. Check the system time or adjust the expression.
The cron triggers several simultaneous runs
Increase the interval or add a locking mechanism to the script.
The task works from the browser but not from cron
The server environment may not load the same variables. Use full paths and explicitly define the required interpreter.
Frequently asked questions
Are cronjob and scheduled task the same thing?
Yes. “Scheduled task” is the common way to describe a cronjob.
Can I run a URL?
Some applications provide a URL, but it’s usually better to use the command recommended by their documentation and protect any public endpoint.
What’s the minimum frequency at miHosting?
On free hosting, once every 10 minutes. On professional hosting plans, every 5 minutes.
Do I need a cronjob for WordPress?
WordPress includes an internal system called WP-Cron, but some sites replace it with a real cron job to get more predictable behavior.
Conclusion
A cronjob automates repetitive tasks through a time expression and a command. Set it up from cPanel or DirectAdmin, respect your plan’s minimum frequency, and check the logs before considering it done.
A reasonable schedule improves your site’s reliability without consuming unnecessary resources.