Hi,
I want to run a job in cron on a specific date(say 25th of every month) excluding holidays. Can anyone provide some hints to do this? Thanks for any inputs.
Holidays are often company specific - like in the US a lot of companies grant the day after Thanksgiving.
Put a holiday schedule, updated every year, in a place where your code can read it. Determining holidays has to be up to the script. UNIX does not have such a thing.
Ex:
# holiday file
# Christmas
12-25-2012
crontab
* * 25 * * /path/to/my/script.sh >/path/to/logfile 2>&1
In script.sh:
#!/bin/bash
today="`date +%m-%d-%Y`"
grep -qF "$today" /path/to/holidayfile && exit # do not run on holidays
...rest of script here.