Skip to main content

Learn About Cron Jobs & How To Use Them Via The Shared Web Hosting Control Panel

Quick Intro

Cron is an automated task scheduler that allows you to schedule tasks to run at specific times or intervals. It is an essential tool for automating repetitive tasks in a web hosting environment.

Important To Know Before You Begin

Web Host Most supports Cron Jobs, providing you with the capability to create an unlimited number of Cron Jobs within your account. There are numerous tutorials available online that can help you understand various use cases for Cron.

Accessing Cron

To access the Cron Jobs feature:

  1. Navigate to Development Tools > Cron Jobs in your Web Control Panel.

Creating A Cron Job

Creating a Cron Job is straightforward and can be done with just a few clicks. For instance, if you need a script to perform updates for your application three times a day, you can easily set this up with Cron.

To create a Cron Job:

  1. From your Web Control Panel, go to Development Tools > Cron Jobs.
  2. Click Create Cron Job.
  3. Enter the desired parameters for when and how often the task should run.
  4. Optionally set an email address to receive notifications when the Cron job runs.
  5. Click Create to establish the Cron Job.

Creating a Cron Job

This functionality enables you to automate tasks such as data backups, script executions, or regular cleaning up of temporary files without manual intervention.

Setting Email Notifications

You can configure Cron to send you an email notification upon completion of each scheduled task. This is especially useful for monitoring scripts or important tasks:

  1. When setting up or editing a Cron Job, you will see an option to enter an email address.
  2. Simply input your preferred email where you want to receive the notifications.

Understanding Cron Syntax

The Cron syntax is composed of five fields that represent different units of time:

  • Minute (0 - 59)
  • Hour (0 - 23)
  • Day of the month (1 - 31)
  • Month (1 - 12)
  • Day of the week (0 - 6) (Sunday to Saturday; 7 is also Sunday on some systems)

Examples of Cron Schedules

  • *0 12 * * : Runs every day at 12:00 PM.
  • *0,30 * * * : Runs every hour at the 0th and 30th minute.
  • **/10 * * * : Runs every 10 minutes.
  • 0 20 * * 1-5: Runs at 8:00 PM every weekday (Monday to Friday).
  • *0 0 1 1 : Runs at midnight on the first day of the year.

Conclusion

Cron Jobs are a powerful feature that can help automate and manage tasks efficiently in your hosting environment. By setting up Cron Jobs, you can ensure that important tasks are performed regularly and reliably, reducing the need for manual oversight and increasing operational efficiency.