There are certain tasks on a computer that we need to perform regularly – for example, performing backups. In Linux, the Cron command is used for such repetitive tasks; it is invaluable for executing scheduled jobs. In this article, we will show you how to configure crontab to run a cron job every hour.
What is cron?
Cron is a tool, an application used for scheduling tasks, and running applications and scripts at a specific time in Unix-like operating systems. It allows you to schedule tasks (cyclically running applications or shell scripts) that will automatically run at a specified time and date. These tasks are called cron jobs.
In Linux and Unix systems, cron is commonly used for maintenance or administrative tasks, such as running backups (with the option to later send them to an FTP server, for example) or sending automated emails. Cron can also be used, for instance, to check for system updates and many other things.
Cron uses a configuration file called crontab. A crontab is a plain text file that can be edited with any text editor. The system administrator can configure a global crontab file with root permissions, and additionally, each user can have their own settings, limited by their user permissions.
A cron job is usually executed in the background, and if there is any output, it can be sent to the user via email or saved to a file. Cron is a powerful tool that allows you to automate virtually any task, but it can be difficult for novice users to operate if they are not familiar with the required command syntax.
What can we use cron for?
With cron, we can manage virtually any function of a computer or server and run cyclical tasks at a specific time and date. We can use it for example to:
- Automate repetitive tasks. A cron job can be used to automate tasks at regular intervals, such as running backups or sending cyclical emails, for example, with reminders.
- Run system tasks on a schedule. A cron job can check for available updates for the operating system or applications, or for example, it can regularly clean the computer of temporary files and unnecessary system logs.
- Automatically perform system updates, update security, and install new software. This can help to better secure the system and ensure that we always have the latest versions of applications and libraries installed on our computer or server.
- Improve performance. Thanks to cron, we can configure the execution of tasks that heavily load the computer to run during hours when the computer is least used, for example, at night.
Overall, cron can significantly streamline the performance of cyclical tasks through their automation.
Create a cron job in the Linux terminal
The crontab
command is used to create cron jobs. To create a new cron job:
- Open a terminal window.
- Type the command
crontab -e
to open the cron configuration file. - Add a new entry to the crontab file, remembering to maintain the correct format, otherwise the task will not run:
minute hour day-of-month month day-of-week command-to-execute
An asterisk instead of minutes, hours, or months means that this task will run every hour, minute, or every month. For example, if we want a command or script to run on the hour (i.e., at minute 0) every day of every month, we must type:0 * * * * command-to-execute
- Save the crontab file and close it.
- Use the command
crontab -l
to display the list of saved cron jobs to be executed.
NOTE: The syntax for cron job commands may vary depending on the version of the Linux system. We are basing this on the Ubuntu system. To learn more about the cron application, type man cron
in the terminal.
How to create a cron job in CyberPanel
If your web server is based on LiteSpeed, you should install the CyberPanel overlay. Creating cron jobs in CyberPanel is much simpler and more pleasant than in a crontab file.
- Log in to your CyberPanel Dashboard.
- On the left side, click on Websites, then List Websites, select your website and click Manage.
- Scroll down and click on Cron Jobs.
- To add a new cron job, press ADD CRON. To see a list of existing jobs, click FETCH CURRENT CRON JOBS.




To have a given task run weekly, select Every week from the list. In the example below, cron will run a previously written backup script every week, on Wednesday at 4:16 AM. In the Day of week window, we enter numbers from 0 to 7. 0 or 7 means Sunday, 1 Monday, 2 Tuesday, etc.
We can also enter the days of the week by name in English: mon, tue, wed, thu, fri, sat, or sun.
Press Add Cron to save the created task.
Isn’t configuring cron in CyberPanel more pleasant?