TL;DR
You can make standard cron entries conditionally run by adding short shell tests directly in the crontab. Examples include skipping the last Tuesday of the month, avoiding holidays, running only on clear weather, or letting an LLM decide whether to trigger a job.
What happened
A recent write-up revisits cron and shows how small inline shell checks let you express scheduling rules that crontab syntax alone cannot. Instead of trying to encode complex conditions into the time fields, the technique schedules the job at a regular cadence and prefixes the command with a test that either permits or cancels execution. Sample patterns include checking whether adding seven days stays within the same month to skip the month's last Tuesday, consulting a cached holiday list to suppress runs on public holidays, querying the National Weather Service to run only when the shortForecast contains “clear” or “cloudy,” and piping an RSS feed into an LLM which returns a simple yes/no to decide whether to execute. The post also notes the macOS/BSD date flag (-v) differs from Linux’s -d, and highlights that the square-bracket syntax in the crontab is just the POSIX test command in use.
Why it matters
- Extends cron’s usefulness without replacing it — conditional checks let simple cron lines express more complex schedules.
- Keeps scheduling logic colocated in crontab entries, avoiding separate scheduling daemons or extra orchestration tools.
- Enables jobs driven by external data sources (holiday lists, weather, news) so tasks run only when desired.
- Requires attention to platform differences (date flags) and availability of tools referenced in the test commands.
Key facts
- To skip the last Tuesday of a month, run every Tuesday at 07:00 but test that date +7 days is still in the same month; example uses date -v+7d on macOS/BSD.
- On Linux the equivalent date handling uses -d +7 days instead of -v+7d (platform difference noted).
- The bracketed [ … ] syntax shown in examples is the shell’s POSIX 'test' command executed inline in crontab.
- A holiday-based pattern fetches US public holidays from https://date.nager.at/api/v3/PublicHolidays/2025/US and writes dates into HOLIDAYS.txt using curl and jq.
- An inverse holiday example runs a job only when today matches an entry in HOLIDAYS.txt; another runs daily only on holidays.
- Weather-driven examples query the National Weather Service hourly JSON endpoint (example gridpoints/TOP/32,81/forecast/hourly) and inspect properties.periods[0].shortForecast with jq and grep.
- A news-driven example fetches Google News RSS and pipes it to an LLM that is instructed to respond 'yes' or 'no', with the result gated by grep to decide whether to run the script.
- The original post was published on September 21, 2025 and is roughly a 600-word, 3-minute read.
What to watch next
- Platform differences in date utilities: the example uses -v on macOS/BSD and -d on Linux (confirmed in the source).
- API rate limits and availability when polling external services (not confirmed in the source).
- Security and trust considerations when piping remote content into an LLM or executing commands based on external feeds (not confirmed in the source).
- Environment differences inside cron (PATH, shell) that can affect availability of curl/jq/llm/grep (not confirmed in the source).
Quick glossary
- cron / crontab: A Unix utility and configuration file format for scheduling recurring commands or scripts at specified times or intervals.
- POSIX test ([ … ]): A shell builtin used to evaluate conditional expressions; the bracket syntax is a common shorthand for running tests in scripts or inline commands.
- jq: A command-line tool for parsing, filtering, and transforming JSON data.
- curl: A command-line utility to make HTTP requests and fetch data from URLs.
- RSS: A simple XML-based feed format used to publish frequently updated information, like news headlines, which can be consumed by programs.
Reader FAQ
Can I skip the last Tuesday of every month using crontab alone?
Not with crontab fields alone, but you can schedule every Tuesday and add a date-based test to the command to skip the final Tuesday (example shown).
Is the date syntax the same on all systems?
No. The post notes -v+7d for macOS/BSD and -d +7 days for Linux.
Do these examples require extra tools?
Yes: the examples use curl, jq, grep and in one case an LLM command; those must be available in the cron environment.
Are operational pitfalls like rate limits or security covered?
Not confirmed in the source.

More dynamic cronjobs September 21st, 2025 • ~600 words • 3 minute read I remember learning about cronjobs in the early 2000s. I could tell the computer to go do…
Sources
- More Dynamic Cronjobs
- Running a simple shell script as a cronjob
- Cron Jobs: The Complete Guide for 2025
- CronJob
Related posts
- When ‘-tucky’ Becomes an Insult: The Linguistics of Place-Name Slurs
- HelloFresh coupon codes: Save up to 55% and get free meals with student, hero, and referral deals
- Always Bet on Text: Why Written Language Still Outperforms Rich Media