Cron to schedule 1st Wednesday of every Month??

Is there a way to use cron to run a job on the 1st Wednesday of every month?? The more generic question is, "Are all of the fields in crontab AND'd together or are some OR'd?".

i.e. I had an entry in my crontab this morning as follows and I didn't expect it to run since the day of month is 20 today, but it did run...

#Minute 0-59
# Hour 0-23
# Day of Month 1-31
# Month 1-12
# Weekday 0-6 Sun-Sat
#
22 09 8-14 * 3 /easdwld/audit/dev/bin/purge.audit

As stated in the man page, specification of days may be made by two fields (day of the month and day of the week). Both are adhered to if specified as a list of elements. So you putting Wednesday as being able to run lets it run every Wednesday. You would have to add some logic to your script to get out of that (if date is higher than some number, exit).

Also, you state you want it to run on the first Wednesday yet you have 8-14. Seems to me that would be the second Wednesday of the month.

Some OS's may have different ways of changing this and allow what you are trying - read your man page or post your OS and version.

Following on from RTM's reply.... running your commands via a script would work

try putting something like this in "call_me_from_cron"

#!/bin/bash

DATE=`date +%d`

if [ "$DATE" -le "7" ]; then
  run my commands
fi

exit

then in the crontab:

22 09 * * 3 /path/to/call_me_from_cron

To run the script at 09:22 on the first wednesday of each month.

Cheers
ZB

try this

22 09 * 1-12 3 /easdwld/audit/dev/bin/purge.audit

22 09 * 1-12 3 /easdwld/audit/dev/bin/purge.audit

That won't work - that'll run every wednesday. The OP wants the first wednesday of each month.

Cheers
ZB

Thanks to all for the replies.

We're running AIX 5.1

I had initially coded the "day between 8-14" logic in my script but then thought it would be simpler to make it all happen with cron. But, as I see now, the dayofmonth and weekday are essentially OR'd.

I'll uncomment my date logic in the script and go forward as before.

Thanks again to all!!