Cron Jobs

Cron is a time-based job scheduler in Linux. It allows you to schedule scripts or commands to run automatically at specific times, dates, or intervals.

1. What is a Cron Job?

A "Cron Job" is simply a task that you've scheduled to be executed by the Cron service. Examples include:

2. The Crontab

The crontab (cron table) is the file where your scheduled jobs are stored.

3. Understanding the Schedule Format

Each cron job follows a strict 5-part timing format:

Format: * * * * * command_to_run
1. Minute (0-59)
2. Hour (0-23)
3. Day of month (1-31)
4. Month (1-12)
5. Day of week (0-6, where 0 is Sunday)

Examples:

0 0 * * * /path/to/backup.sh
(Runs every day at midnight).

30 14 * * 1 /path/to/script.sh
(Runs every Monday at 2:30 PM).

*/15 * * * * echo "Checking system..."
(Runs every 15 minutes).