Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crontab for 1st wed. each month.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
is it possible to run a cron job for the 1st wednesday of each month or do i need a script? if i need a script, what would it be?

FYI:if it matters, this is for AIX.

thanks.

 
The following will run 'do_something' at 4am on Wednesdays that are the 1st-7th of every month (which is the same as 1st Wed of every month).

0 4 1-7 * 3 do_something
 
i thought of that but the man pages say:

" * If either the month of the year or day of the month fields is specified as an element or list and the day of the week field is also specified as an element or list, then any day matching either the day of the week field, or month of the year and day of the month fields are matched."

so wouldn't that run on every day of the 1st week of the month and every wednesday?
 
You could put a condition at the start of the script that says something like
if test `date "+%A"` = "Wednesday"
then
echo "It's Wednesday"
fi SOL
"If I'm talking c**p, I'm probably p****d"
 
You could expand on that :-

If `date "+%A"` = "Wednesday"
then
if `date &quot;+%d&quot;` < 8
then
echo &quot;Its the first Wednesday&quot;
fi
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top