Save the following as usr/local/bin/is_third_week_in_month. Sh or some place.
Save the following as /usr/local/bin/is_third_week_in_month. Sh or some place #! /bin/bash if $#!
= 3 then echo "Usage: $0 " 1>&2 exit 127 fi YEAR=$1 MONTH=$2 DAY=$3 FIRST_WEEK_IN_MONTH=`date +%V -d $YEAR-$MONTH-01` WEEK_FOR_DAY=`date +%V -d $YEAR-$MONTH-$DAY` DIFF=$(($WEEK_FOR_DAY - $FIRST_WEEK_IN_MONTH)) if $DIFF = 2 then # this is the third week exit 0 else exit 1 fi and then add to crontab 12 00 * * 1,2,3,4,5 your_command 12 00 * * 6,7 test! /usr/local/bin/is_third_week_in_month. Sh `date "+%Y %m %d"` && your_command Or you could modify the script to check for date as well if you want to only have one line in crontab.
On my system, date +%V prints a leading zero for single digit week numbers. That makes the calculation of $DIFF think it's got octal values and fail. Try running this script for 2009 02 19, for example.
Strip the leading zero as follows: FIRST_WEEK_IN_MONTH=date +%V -d $YEAR-$MONTH-01|sed s/^0// --- and on the next line --- WEEK_FOR_DAY=date +%V -d $YEAR-$MONTH-$DAY|sed s/^0// – Dennis Williamson Apr 19 '09 at 15:36 Also, the ISO week number (%V) for Jan 1 can be 52 (e.g. 2006) or 53 (e.g. 2005) which can cause th $DIFF calculation to be negative and fail to find week 3 in January.So you should change the "%V"s to "%W" which always starts the year in week zero or one and ends the year in week 52 or 53 (%V can end the year in 52, 53 or 1). – Dennis Williamson Apr 19 '09 at 20:31.
Run it on the 1st, 2nd, 4th (and maybe 5th, it can happen) weekends. # m h dom mon dow command * * 1-20,28-31 * 0 echo #test I have no idea if that will run everyday, or just on Sundays (day 0), but it won't run on the 21st to 27th - the third week. It may be simple enough to put a check in the script that will exit if it is the third week (or it's not a Sunday).
This won't actually work (at least not with vixie cron). This will cause the script to run on days 1-20, 28-31, and every Sunday. When dom and dow are specified, the script is run when either condition succeeds.
– Sean Bright Apr 10 '09 at 0:11 I stand corrected - but a check in the script for a 'not-sunday, so exit' would solve that. Then again, so would running it every sunday, and then exiting if was the 21st-27th. – Alister Bulman Apr 10 '09 at 0:23.
Make a cron job that runs a given script when needed ignoring the 3rd weekend part make a cron job that runs on the 21 and another on the 28 to switch the script out and back for another no-op script. Hacky but it would work.
If you want it to run on any possible Saturday except the third one (try #3): GREP=/usr/local/bin/grep TODAY=/bin/date "+%d" THIRD_SAT=/bin/date -v1d -v+1m -v-7d -v-sat "+%d" #min hr day month weekday script 0 0 * * 6 ($THIRD_SAT | $GREP $TODAY) || /bin/echo doit.
This won't actually work (at least not with vixie cron). This will cause the script to run on days 1-13, 21-31, and every Saturday. When day of month and day of week are specified, the script is run when either condition succeeds.
– Sean Bright Apr 10 '09 at 0:12 Thanks for pointing that out. I hadn't realized the last two columns are ORed instead of ANDed. Learn something new every day!
– Rick C. Petty Apr 10 '09 at 0:49.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.