Blog · WebJi® India

What is a cron job?

Quick answer: A cron job is a command a Linux server runs on a clock. The crond daemon checks the crontab every minute and starts any line whose five fields (minute, hour, day, month, and weekday) match that minute. Nobody has to be logged in. Backups, cache clears, and mail digests are the jobs people schedule first.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Indian freelancer's desk with a laptop showing a website, potted plant and coffee in warm window light — what is a cron job

What is a cron job in simple words?

A cron job is one scheduled line: a time pattern plus a command. Cron is the scheduler. The crontab is the file of those lines. Crond is the daemon that reads the file.

The cron workflow is a one-minute loop. Crond wakes, compares the server clock with every line, and runs the commands that match. It does not wait for a login or a click.

  • Cron is the scheduler on Linux and other Unix-like systems.
  • A cron job is one scheduled command.
  • The crontab is the list of those commands.
  • Crond is the background process that starts them.

Windows does not ship cron. The same idea there is Task Scheduler. A hosting account is almost always Linux, so the schedule here is crond and the crontab.

How does crontab syntax schedule a cron job?

A crontab line is five numbers or stars, then the command. The fields, in order, are minute, hour, day of month, month, and day of week. A hosting crontab does not use a seconds field. Some app schedulers do.

Indian freelancer's desk with a laptop showing a website, potted plant and coffee in warm window light — what is a cron job
FieldRangeMeaning
Minute0–59Which minute
Hour0–23Which hour
Day of month1–31Which date
Month1–12Which month
Day of week0–7 (0 and 7 = Sunday)Which weekday

An asterisk means every allowed value in that field. A comma lists values, so 1,15 as the minute is minute 1 and minute 15. A hyphen is a range: 1-5 as the weekday is Monday through Friday when 1 is Monday. A slash steps through values. In the hour field, */12 means every 12 hours.

  • 0 2 * * * runs at 02:00 every day.
  • 0 */12 * * * runs at minute 0 of every 12th hour.
  • */15 * * * * runs every 15 minutes.
  • 0 9 * * 1 runs at 09:00 on Monday.

@daily is midnight and @hourly is minute 0 of every hour. Both still follow the server clock, not the clock on your laptop.

How do you add a cron job command in cPanel?

On cPanel the cron job command is the text in the Command box. The five time fields only decide when that command starts. Open Advanced, then Cron Jobs. Common Settings can fill the times. You still type the command.

  1. Log in to cPanel and open Advanced, then Cron Jobs.
  2. Set the timezone if the screen offers one. For India, choose Asia/Kolkata.
  3. Pick a Common Setting, or type the five fields.
  4. In Command, use full paths, for example /usr/local/bin/php /home/USER/public_html/cron.php.
  5. Save. The panel emails anything the command prints, unless you send that output to a file.

You know it worked when the next matching minute produces the email or the log line you expected. A mail that says the command was not found means the PHP path or the script path is wrong. Fix the path before you change the times.

Run the job as the site user. cPanel already does that on shared hosting. Use a full path to PHP and to the script so a short name cannot hit the wrong program.

On a Linux shell the same job is one line in your user crontab. crontab -e edits it, crontab -l lists it, and crontab -r deletes every line. Use crontab -i if you want a confirmation before that delete.

cPanel hosting is the panel route. Shared hosting accounts at WebJi® use that panel, and the plan price is confirmed by email before you pay.

What website tasks belong on a cron job?

Put a task on a cron job when it must happen on a clock, not when a visitor happens to load the page. Use the command and the interval the app documents.

  • A database dump, then a copy to the storage on the server backup page.
  • Deleting cache or session files older than a day.
  • Rebuilding a sitemap on a large site.
  • Sending a digest or a renewal reminder.
  • Calling a Laravel or custom scheduler endpoint.

Do not add a second job that fights one the host already runs. Certificate renewal is usually already handled. A job that imports orders or sends mail should not start again while the last run is still going.

How is WordPress wp-cron different from a cron job?

wp-cron is not a system cron job. WordPress checks its event list when someone loads a page. A quiet site can miss the hourly task because nobody visited. A busy site can run that check on many visits at once.

The usual fix on shared hosting is a real cron job every 15 minutes that requests wp-cron.php with the doing_wp_cron query, plus DISABLE_WP_CRON set to true in wp-config.php so page loads stop triggering it. The steps to turn the built-in check off are in how to disable wp-cron.

You know the real job is working when that URL is requested on the 15-minute mark and a scheduled post publishes with no visitor opening the site.

How do you prove a cron job ran?

A cron job ran only if you can see that crond started it and that the command finished. The start line and the script output are different facts.

  • cPanel emails stdout and stderr to the address on the Cron Jobs screen. Silence means the command printed nothing, not that it failed.
  • Append >> /home/USER/logs/cron.log 2>&1 and read that file after the scheduled minute.
  • On a VPS, grep CRON /var/log/syslog or /var/log/cron shows that crond started the line. It does not show whether the script succeeded.

If the mail says the command was not found, fix the path before you change the schedule. If that mail is unclear, email support@webji.services. The desk replies in Hindi and English, and the average first reply is under 60 minutes. The office phone is not a support line.

Why do cron jobs miss a run or overlap?

The five fields use the server clock. If the cPanel cron screen or the date command shows UTC, 0 2 * * * is 02:00 UTC, which is 07:30 IST. Set the cron timezone to Asia/Kolkata when the schedule is meant for India.

A job longer than its gap can start a second copy. flock -n with a lock file skips the new start while the first copy holds the lock. Classic cron does not catch up if the server was off at that minute. The next matching minute is the next run.

One form is flock -n /tmp/job.lock /home/USER/script.sh. If the lock is busy, that start is skipped.

A cron job starts because the clock matched. A batch job starts because a queue or a person submitted work, and it can wait for CPU. Cron can launch a batch. The clock and the queue are different triggers.

Frequently Asked Questions

What is a cron job in simple terms?

A cron job is a command the server runs on a schedule you set. Crond checks the crontab every minute and starts the command when the five time fields match. You do not have to be logged in.

How do I create a cron job in cPanel?

Open cPanel, then Advanced, then Cron Jobs. Fill the five time fields or use Common Settings, paste the full command, and save. The next matching minute should send the command output by email or write the log you set.

What does the asterisk mean in a cron job?

An asterisk in a field means every allowed value. A star in the hour field means every hour. A star in the weekday field means every day of the week. A step such as */12 in the hour field means every 12 hours, not every hour.

How do I run a cron job every 12 hours?

Use 0 */12 * * * and then the command. That runs at minute 0 of every 12th hour, every day. The clock is the server clock. If the server is on UTC, those hours are UTC, not IST.

What is a cron job versus a batch job?

A cron job starts because the time matched. A batch job starts because work was queued, and it can wait for resources. Cron can launch a batch, but the clock and the queue are different triggers.

What is wp-cron and is it a real cron job?

No. wp-cron runs when WordPress gets a page view, unless you turn it off and call wp-cron.php from a real cron job. A site with no visitors can miss the schedule until that system job is in place.

How do I check whether my cron job ran?

Read the cPanel email for that command, or the log file you added on the command line. On a VPS, the cron log shows that crond started the line. A start line plus the script output is the proof.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →