[wplug] Determine the "Last Full Week" of the month

Kevin Squire gentgeen at wikiak.org
Wed Oct 20 09:37:10 EDT 2010


I have to work out a script (prefer bash in this case, but any will
work) for work that will run on the 1 day of the week (sunday) but ONLY
if it is the last full week of the month.

For now I am only focusing on months with 31 days.  (by some luck,
the only months I actually have to run this thing all have 31 days).

If anyone has something already ... great... could you please share.

Here is the logic I am going for now (and my question).. Does this
logic seem right?

  a) The latest possible date is the 25th .. anything after the 25th,
  and there are not enough days to make a full week.
  b) The earliest possible date is the 19th... anything before the 19th
  would mean there is at least another full week.
  c) Have a cron entry that runs from the 19th to the 25th of each month
  d) Script checks if month has 31 days AND if "TODAY" is sunday AND
  if "TODAY + 7" is still within this month. (if all true - process, if
  any false - exit)

Am I heading down the right path?  Or does my logic seem flawed to you?


-- 
http://www.wikiak.org

#############################################################
 Associate yourself with men of good quality if you esteem    
 your own reputation; for 'tis better to be alone then in bad 
 company.        - George Washington, Rules of Civility


More information about the wplug mailing list