Linux Commands

How to Schedule a Crontab Job for Every Hour

Most Linux users are familiar with the Crontab job scheduler, which acts as a silent daemon that performs all the tasks assigned to it automatically, without any human intervention. This job scheduler makes the life of a Linux user much easier, as the user can hand over all the frequently occurring tasks to the Crontab scheduler so that these tasks can be executed automatically according to a specified schedule.

At times, you may wish to execute a specific task once every hour. This could be an extremely challenging task for a user if the task were to be performed manually, as the user would have to be available every hour to execute that task. If the task is extremely critical and somehow the user misses the time to execute it, this could lead to severe consequences.

The Crontab job scheduler can be a blessing in such situations. With Crontab, you can add tasks to the Crontab file to be executed as a job at specified times. This article will show you how to schedule a Crontab job to occur once every hour in Linux Mint 20.

Method for Scheduling a Crontab Job for Every Hour

To schedule a crontab job to occur once every hour in Linux Mint 20, follow the steps listed below.

Step 1: Create Task to Schedule As Crontab Job

First, we will define a task that we want to run as a Crontab job once every hour. This task can be anything from creating a backup to running a simple bash script. In this example, we will create a bash script that will run every hour. We will create a bash file in our Home directory and add a script to print a random message in the terminal in this bash file, as shown in the following image. Then, we will simply save this file and close it. We will define the job so that this bash script is executed every hour.

Step 2: Start Crontab Service

As you can see in the screenshot below, we have launched a new terminal window before starting the new crontab service.

Before adding this script as a job to the Crontab file, we first need to start the Crontab service, which can be done by executing the following command:

$ sudo systemctl start cron

Running this command will start the Crontab service immediately without displaying any output on the terminal.

Step 3: Check Status of Crontab Service

Although the above command automatically starts the Crontab service, you can check the Crontab service before proceeding further by verifying its status through the following command:

$ sudo systemctl status cron

If the Crontab service has successfully started, then running the above command will show you the “Active (Running)” status, as shown in the image below. This status will confirm that the Crontab service is running correctly.

Step 4: Launch Crontab File

Once you have confirmed that the Crontab service is running properly, you can open the Crontab file to add the desired job to it, to be scheduled every hour. The Crontab file can be opened by running the following command in the terminal:

$ crontab –e

This command will open the Crontab file in the terminal.

Step 5: Add Task to Crontab File to Be Executed Every Hour

Once the Crontab file is opened, you will need to press Ctrl + O to edit it. Next, add the line highlighted in the following image to your Crontab file. In this line, the “0 * * * *” parameter will tell the Cron daemon to execute the job once every hour. We have written the path of our bash file in this line so that the Cron daemon can easily access the bash file whenever the job is executed. In the same manner, you can also add any other command that you want to be executed every hour instead of giving a file path. After adding this line, you can save this file and close it.

Once you close this file, the Cron daemon will automatically install the new Crontab, as shown in the image below. This way, you do not have to explicitly tell your system that you have added a new Crontab job to the Crontab file because the Cron daemon itself performs this job whenever you make any modifications to the file. Once the new Crontab file has been installed, the job will be executed every hour.


In this tutorial, you learned a simple method of scheduling a Crontab job every hour. In the example discussed in this article, we created a Crontab job for a bash file to be executed every hour. You can create any other task that is to be executed every hour as a Crontab job by following the very same procedure. Moreover, if you want your Crontab job to be executed at a specific time within the hour, for example, at 10:30, then at 11:30, and so on, then you can do this by changing the “0” minute field to “30.” In this way, you can play around more with scheduling jobs using the Cron daemon.

About the author

Aqsa Yasin

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.