October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Five Cron Fields, One Trap: Why Cron Jobs Run on Unexpected Days

When both day-of-month and weekday are restricted, Cronie can run a job when either matches. Learn how to avoid unexpected runs and verify your scheduler’s rules.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a cron job specifies both a day of the month and a weekday, it may run when either field matches—not only when both match. That is the documented behavior of Cronie when both day fields are restricted, and it can turn an expression that looks like “the 1st or 15th, but only on Friday” into a job that runs every Friday as well.

How to read the five cron fields

A standard user crontab entry has five time-and-date fields followed by the command:

As an Amazon Associate I earn from qualifying purchases.

minute hour day-of-month month day-of-week command

For example, 30 4 1,15 * 5 command breaks down as follows:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Field Value Meaning
Minute 30 At minute 30
Hour 4 At hour 4
Day of month 1,15 On the 1st or 15th
Month * Every month
Day of week 5 Friday in Cronie

In a user crontab, the command begins immediately after the five fields. System crontabs such as /etc/crontab also have a username field before the command. See the Cronie crontab manual and Debian cron manual for their respective formats.

#1 Best Overall
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
  • Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

The trap: the two day fields may mean OR

In Cronie, when both day-of-month and day-of-week are restricted—neither field contains *—a match in either field is enough to run the job. The condition is effectively “day of month matches OR weekday matches,” not “day of month matches AND weekday matches.”

So 30 4 1,15 * 5 runs at 04:30 on the 1st and 15th of each month, and also at 04:30 every Friday. A Friday that falls on the 1st or 15th qualifies, but so does a Friday on any other date. The Cronie manual documents this behavior; it should not be assumed for every cron-like scheduler.

Rank #2
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
  • Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
  • Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
  • CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
  • CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
  • CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)

Why a syntax check will not catch the calendar mistake

An expression can be valid cron syntax and still describe the wrong schedule. On versions that support it, crontab -T checks syntax; it does not establish that the calendar logic matches your intention. The Linux man-pages and Cronie manuals document the option, but check the installed implementation and version before relying on it: Linux man-pages crontab(5) and Cronie crontab(5).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To verify calendar behavior, evaluate upcoming dates for the actual scheduler or test the condition separately in the command. Debian’s cron manual illustrates the latter for a second Saturday: schedule dates 8 through 14, then use a shell date check to run only when the date is Saturday. This is a Debian-manual example, and its shell and date syntax should be adapted and tested in your environment.

date +%u

In that example, the date output can be checked for Saturday before running the intended task. Cron command parsing matters: in Cronie, an unescaped % in the command is converted to a newline, and text after the first percent sign is sent to standard input. Escape percent signs where needed, and check the target implementation’s manual before using this pattern. See the Debian cron manual and Cronie manual.

Confirm which cron implementation is running

“Cron” is not one universal grammar. Cronie documents the either-field rule above. Debian’s cron manual describes an implementation distinction from the POSIX behavior it discusses for cases involving an asterisk in one of the two day fields; it also explains that its implementation checks the first character of a day-field value for *. This is a specific distinction, not a basis for assuming how all schedulers behave.

Rank #4
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
  • Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz
  • 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
  • 2 × USB 3. 0 ports, 2 x USB 2. 0 Ports
  • 2 × micro HDMI ports supproting up to 4Kp60 video resolution
  • Micro SD card slot for loading operating system and data storage

Before depending on a day-of-month/day-of-week combination, identify the daemon and consult the manual for the installed version. A traditional cron daemon and a cron-like service may use different rules, extensions, validation options, or timezone settings. For Debian’s documented semantics, consult its trixie cron manual.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check weekday numbering, timezone, and daylight saving

  • Weekday numbers: Cronie accepts 0 through 7, with both 0 and 7 meaning Sunday. Do not assume another implementation uses identical numbering; see the Cronie manual.
  • Timezone: Confirm the timezone used by the cron daemon, especially if the host, job, or intended business calendar uses a different zone.
  • Daylight saving: Cronie says a scheduled local time that does not occur during the spring transition does not match, while a local time that occurs twice during the autumn transition can match twice. Check the target daemon’s documentation if duplicate or skipped runs would matter.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A separate step-syntax gotcha

Step syntax is local to its field; it does not measure elapsed time across field boundaries. For example, the Linux man-pages describe */35 in the minute field as running at minute 0 and minute 35 of each hour—not once every 35 elapsed minutes. See Linux man-pages crontab(5).

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$259.95
Bestseller No. 2
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM); Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
$159.99
Bestseller No. 4
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz; 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
$92.97
Bestseller No. 5
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$419.99
Best Value
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
  • Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.