Answered by the Webhosting Experts

What is Cron Job?

A cron job is a Linux command used for scheduling tasks to be executed sometime in the future. This is normally used to schedule a job that is executed periodically – for example, to send out a notice every morning. Some scripts, such as Drupal and WHMCS may require you to set up cron jobs to perform certain functions.

For most cron jobs, there are three components present:

  1. The script that is to be called or executed.
  2. The command that executes the script on a reoccurring basis. This is typically set in cPanel.
  3. The action or output of the script, which depends on what the script being called does. Frequently, scripts called as cron jobs modify files or databases. However, they can perform other tasks that do not modify data on the server as well, such as sending out email notifications.

Most scripts that require the use of a cron job will give you specific instructions on what needs to be setup, frequently giving examples.

 

Using cPanel to Set a Cron Job

To add a cron job in cPanel, follow these steps:

  1. First, you’ll need to log in to cPanel
  2. From the dashboard, either search for Cron Job or navigate to the Advanced menu and click on the icon for Cron Jobs

    cPanel Advanced tab showing the Cron Jobs icon

  3. Next, you’ll need to select an email where you’d like to receive cron output. If the email address listed beside Current Email is valid, simply leave it. If you’d like to use a different email address, enter it into the form field next to Email and click Update Email once you’ve finished

    Window showing current email address as well as the option to update to a different email address for cron job output

  4. In the section labelled Add New Cron Job, you can specify what command you’d like to run as well as its frequency. Start by entering your desired command in the bottom form field labelled Command. You can list any Linux command here or, if you have a file you’d like to run at a certain time, simply provide the path to the file you’d like to run

    Add New Cron Job window highlighting the "Command" form field

  5. Next, move back up to the form field labelled Common Settings and select which frequency you’d like the command to run at from the available options listed in the dropdown menu. This will automatically update the other time settings according to your choice

    Add New Cron Job window highlighting the "Common Settings" for recurring commands

  6. Alternatively, you can choose to enter your recurring frequency manually by adjusting the individual time settings. Minute, Hour, Day, Month, and Weekday can all be modified to achieve your intended results

    Add New Cron Job window highlighting the individual time settings for recurring commands

  7. When you’ve finished making your selections, simply click the Add New Cron Job button to finalize the process

    Window highlighting the "Add New Cron Job" button

And now you’ve successfully scheduled a command using the Cron Jobs tool within cPanel. If you have other commands that need to be set, simply repeat this process for any other commands.

Not a cPanel user? No problem! Read on to learn how to schedule cron jobs using the Plesk control panel as well.

 

Using Plesk to Set a Cron Job

to add a cron job using Plesk, just follow these steps:

  1. First, log in to your Plesk control panel
  2. Once you’re logged in, on the left side of the dashboard under Server Management, click the option for Tools & Settings

    Plesk control panel dashboard highlighting "Server Management" and the "Tools & Settings" option
  3. Now, on the right side panel, under Tools & Resources, click on Scheduled Tasks

    Tools & Resources options highlighting "Scheduled Tasks"
  4. On the next screen, click on Plesk Administrator User

    System User tab with the "Plesk Administrator" option highlighted
  5. On the Scheduled Tasks screen, under Tools, click on Add New Task

    Scheduled Tasks window highlight the option to "Add New Task"
  6. On the following screen, provide all requested information as shown in the image below

    Task information window showing a sample description, scheduler notification, file path, and task priority

  7. Now, scroll down a bit and in the section beneath Task priority, you’ll see a calendar. Here, you can select the frequency with which your command runs. For this example, we’ve selected Every day, Every month, and under Days of the week we’ve also selected Every day

    Sample calendar showing highlighting the option to schedule every day of every month
  8. If you want to schedule a different frequency with which your command will run, simply select the corresponding check boxes. For instance, if you wanted a scheduled task to run every minute of every hour, or every day, you’re calendar would look like this:

    Sample calendar window highlighting the option to schedule for every minute of every hour of every day

  9. Once you’ve finished scheduling your task per your requirements, simply click OK to finalize your selections

And now you’ve successfully schedule a cron job using the scheduled tasks tool within Plesk.

Now that you know how to schedule tasks using both cPanel and Plesk, you should be ready to start scheduling cron jobs as needed. Just remember, if you encounter any problems, feel free to issue a support ticket and our support team will be happy to help.

 

Popular Links

Looking for more information on Cron Jobs? Search our Knowledge Base!

Interested in more articles about Web Hosting? Navigate to our Categories page using the bar on the left or check out these popular articles:

Popular tags within this category include: DNS, FTP, IIS, MX Records, and more.

Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.

 

The Hivelocity Difference

Seeking a better Dedicated Server solution? In the market for Private Cloud or Colocation services? Check out Hivelocity’s extensive list of products for great deals and offers.

With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.

Unsure which of our services is best for your particular needs? Call or live chat with one of our sales agents today and see the difference Hivelocity can make for you.

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: support@hivelocity.net. We are also available to you through our phone and live chat system 24/7/365.