Cron expression to run on different days for different months
I don't think you can do this with one expression, but two should be ok
0 0 1 1,2,4-12 * expr
0 0 15 3 * expr
i.e. the first expression runs for all months other than March. The second for March only.
Alternatively, you could specify that your script runs on the 1st and 15th, and your script could check which day is valid given the month. That would give you one expression, but you're splitting the date analysis between cron and your script, and consequently I don't think that's a particularly good solution. It's worth bearing in mind for more complex scenarios.
How to schedule a Cron job for multiple days every month?
maybe your cron does not support the "L" flag. you can refer to this CRON job to run on the last day of the month
cron expressions for different months
It is like : minute hour day(in number) month day of week.
0 0 6 * * It will schedule to 6 july 2018.
0 0 6 6 * It will schedule to 6 june 2019 ( because 6 june has passed this year)
0 0 6 7 * It will schedule to 6 july 2018 ( because it is yet to come )
I hope it helped you.
Here is a link for your help : https://crontab.guru/
cron expression to run every 6 months and on second friday of the month
0 0 12 ? 1-7/6 6#2
0 --> run only at Secs :00
0 --> run only at minute :00
12 --> Runs on 12 noon
? --> no specific value
1-7/6 --> runs only on months 1 (January) or 7 (July)
6#2 --> Second friday of the month
Next few Schedules
1. Friday, January 9, 2015 12:00 PM
2. Friday, July 10, 2015 12:00 PM
3. Friday, January 8, 2016 12:00 PM
4. Friday, July 8, 2016 12:00 PM
5. Friday, January 13, 2017 12:00 PM
Cron Job only specific months
It can be something like below:
0 0 1 2,3,4,5,6,7,8,9,10,11,12 *
Related Topics
Simplest Way to Build Dotnet Sdk Project Requiring Net461 on Macos
Thread Quantum: How to Compute It
Find Files and Print Only Their Parent Directories
Docker Create Two Bridges That Corrupts My Internet Access
How to Disable Tcp Slow Start in Linux
Vimdiff: How to Put All Changes Inside a Particular Function from One File to Another
Create Infinite Looping Repeating File Cat in Linux/Bash
How to Use Performance Counters Inside of The Kernel
How to Send a Mail with a Message in Unix Script
Nasm Assembly Linux Timer or Sleep
Linux/Unix Socket Self-Connection
Error While Installing Mongodb on Ubuntu 16.04
How to Export a Symbol from an External Module
Command-Line Fulltext Indexing
What Is The Current State of Tail-Call-Optimization for F# on Mono (2.11)