I want to make a crontab entry which will run on every weekday except the 1st, 2nd, and 3rd of each month. Here's what I have:
45 8,12,16 4-31 * 1-5 my_program
minutes: 45 past the hour
hours: 8, 12, and 16
day of month: 4th to 31st inclusive
day of week: Monday to Friday inclusive
% rpm -qf `which crontab`
% rpm -q fedora-release
Note: The day of a command's execution can be specified by two fields — day of month, and day of week. If both fields are restricted (i.e., aren't *), the command will be run when either field matches the current time. For example, ``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday. One can, however, achieve the desired result by adding a test to the command (see the last example in EXAMPLE CRON FILE below).
The mentioned example looks like this:
0 4 8-14 * * test $(date +\%u) -eq 6 && echo "2nd Saturday"
So in your case it would be like this (not tested):
45 8,12,16 4-31 * * test $(date +\%u) -lt 6 && my_program