What is a Cron Job?

A cron is a time-based scheduler that uses cron to schedule jobs periodically at fixed times, dates, or intervals. It runs a command or script on your server automatically. Cron jobs are used for scheduling jobs periodically at fixed intervals.

 

Setting a cron job:

Step 1 : Login to cPanel; Go to Section ADVANCE and choose Cron Jobs. If you wish for cron notification then,

Cron Email (optional)

You can have cron send an email every time it runs a command which produces output. If you do not want an email to be sent for an individual cron job, you can redirect the command’s output to /dev/null. For example: mycommand >/dev/null 2>&1.

 

Step 2 : Complete the common settings (allows you to select a commonly used interval):

Minute — To select the number of minutes between running the cron job, or the minute each hour on which you wish to run the cron job.

Hour — To select the number of hours between running the cron job, or the hour each day on which you wish to run the cron job.

Day — To select the number of days between running the cron job, or the day of the month on which you wish to run the cron job.

Month — To select the number of months between running the cron job, or the month of the year in which you wish to run the cron job.

Weekday — To select the day(s) of the week on which you wish to run the cron job.

 

Values allowed are :-

minute 0-59

hour 0-23

day of month 1-31

month 1-12 (or names, see below)

day of week 0-7 (0 or 7 is Sun, or use names)

 

Step 3 : Click on Add New Cron Job to your cron job.

To view the scheduled cron jobs:

 

The Current Cron Jobs table displays the cron jobs you have already set up on the server.

 

To edit a cron job:

Step 1: Locate the cron job you wish to edit.

Step 2: Edit the settings you wish to change.

Step 3: Click Edit Line.

 

To delete a cron job:

Step 1: Locate the cron job you wish to delete.

Step 2: Click Delete.

Step 3: Clicking Delete, the scheduled cron job is deleted.

 

Successfully you have added a cron job.

Ця відповідь Вам допомогла? 0 Користувачі, які знайшли це корисним (1 Голосів)