Deprecated: Function WP_Dependencies->add_data() was called with an argument that is deprecated since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /home/kcitemin/public_html/wp-includes/functions.php on line 6131
Skip to content

Study Content

  • PHP
  • SQL
  • CodeIgniter
  • Laravel
  • CSS
  • HTML
  • JavaScript
  • Jquery
  • Cron Commands

Category: Cron Commands

Cron commands, often referred to as cron jobs, are scheduled tasks or commands that are executed automatically at predefined intervals on Unix-like operating systems. The cron service is a time-based job scheduler in Unix and Unix-like operating systems, including Linux. It allows users to schedule jobs (commands or scripts) to run periodically at specified times or intervals.

The term “cron” comes from the Greek word “chronos,” meaning time.

Here are some key concepts related to cron commands:

Cron Syntax:

A cron command is defined by a line in the cron table (crontab) with a specific syntax. The syntax includes fields for specifying the minute, hour, day of the month, month, and day of the week when the command should be executed.

* * * * * command-to-be-executed
Each asterisk (*) represents a wildcard, allowing for all possible values. Users can customize each field to define the timing of the cron job.

Common Fields in a Cron Job:

Minute (0 – 59): The minute when the command should be executed.
Hour (0 – 23): The hour when the command should be executed.
Day of the Month (1 – 31): The day of the month when the command should be executed.
Month (1 – 12): The month when the command should be executed.
Day of the Week (0 – 6, where Sunday is 0 and Saturday is 6): The day of the week when the command should be executed.
Examples of Cron Commands:

Execute a command every day at midnight:

0 0 * * * command-to-be-executed
Execute a command every hour:

0 * * * * command-to-be-executed
Execute a command every Monday at 3:30 PM:

30 15 * * 1 command-to-be-executed
Managing Cron Jobs:

Users can view and edit their scheduled cron jobs using the crontab command. The crontab command opens the user’s crontab file in an editor, allowing them to add, remove, or modify scheduled tasks.

crontab -e
The crontab -l command lists the user’s current cron jobs.

System Cron Jobs:

In addition to user-specific cron jobs, system administrators can configure system-wide cron jobs by placing scripts in directories like /etc/cron.daily/, /etc/cron.hourly/, etc.
Cron commands are useful for automating repetitive tasks, such as backups, system maintenance, data processing, and more. They provide a way to schedule tasks without manual intervention, contributing to the efficiency and reliability of system administration and automation.

Copyright © 2026 Study Content