0 0/10 * 1/1 * * Cron

5 min read Jul 03, 2024
0 0/10 * 1/1 * * Cron

Cron Job: 0 0/10 * * * Explained

Cron jobs are a fundamental concept in Linux-based systems, allowing users to schedule tasks to run at specific times or intervals. One of the most common and powerful ways to schedule tasks is using the cron daemon, which uses a specific syntax to define when and how often a task should be executed. In this article, we'll break down the cron job syntax 0 0/10 * * * and explain what each part means.

The Syntax

The cron job syntax consists of five fields separated by spaces:

minute hour day month day_of_week command

Let's examine each field in the context of the 0 0/10 * * * syntax:

Field 1: Minute (0)

The first field specifies the minute of the hour when the command should be executed. In this case, the value 0 means the command will run at the start of every hour, on the hour (e.g., 12:00, 1:00, 2:00, etc.).

Field 2: Hour (0/10)

The second field specifies the hour of the day when the command should be executed. The value 0/10 is a special notation that means "every 10 hours starting from 0". This means the command will run every 10 hours, starting from midnight (0:00), then at 10:00, 20:00, and so on.

Field 3: Day (asterisk)

The third field specifies the day of the month when the command should be executed. The asterisk (*) is a wildcard character that means "any value". In this case, it means the command will run every day of the month, regardless of the day number.

Field 4: Month (asterisk)

The fourth field specifies the month when the command should be executed. Again, the asterisk (*) means "any value", so the command will run every month, regardless of the month number.

Field 5: Day of the week (asterisk)

The fifth field specifies the day of the week when the command should be executed. The asterisk (*) means "any value", so the command will run every day of the week, regardless of the day name (Monday, Tuesday, etc.).

Putting it all together

When we combine all the fields, the cron job 0 0/10 * * * will execute the command every 10 hours, starting from midnight, on every day of the month, every month, and every day of the week.

For example, the command will run at the following times:

  • 0:00 (midnight)
  • 10:00
  • 20:00
  • 30:00 (next day)
  • 40:00 (next day)
  • ...and so on

In conclusion, the 0 0/10 * * * cron job syntax is a powerful way to schedule tasks to run every 10 hours, starting from midnight, on every day of the month, every month, and every day of the week.

Related Post