Re: Scheduling Jobs - Last day of the month - HOWTO?



On 2006-08-30, Michael B Johnson wrote:
I would like to schedule a job on the last day of each month.

When I looked through the man pages for Cron, there did not appear to be any
obvious mechanism for specifying the *last day* of the month.

Unfortunately, my environment is Cygwin, and the job to be launched (executable)
was written in Visual Basic 6. I have access to "bash" via cygwin, as well as
perl and awk.

I realize this may not be the ideal group in which to post this; if you have no
other suggestions that appear appropriate, then please suggest a group where the
question might /be/ more appropriate. However, I would request indepth
consideration be given to my request before being sloughed off, as I don't have
access to any newsgroups specific to Cygwin, that are in English.

0 0 31 1,3,5,7,8,10,12 * /path/to/script
0 0 30 9,4,6,11 * /path/to/script
0 0 28,29 2 * /path/to/wrapperscript

In the wrapperscript, called only in February, check whether the
current year is a leap year:

eval "$(date "$@" "+year=%Y day=%d)"
case $year in
*0[48] |\
*[2468][048] |\
*[13579][26] |\
*[02468][048]00 |\
*[13579][26]00 ) [ ${day#0} -eq 29 ] && /path/to/script ;;
*) [ ${day#0} -eq 28 ] && /path/to/script ;;
esac
}


--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.



Relevant Pages

  • Re: Scheduling Jobs - Last day of the month - HOWTO?
    ... Unfortunately, my environment is Cygwin, and the job to be launched ... I realize this may not be the ideal group in which to post this; ... However, I would request indepth ... but - have you considered running it ...
    (comp.os.linux.misc)
  • Scheduling Jobs - Last day of the month - HOWTO?
    ... When I looked through the man pages for Cron, there did not appear to be any ... Unfortunately, my environment is Cygwin, and the job to be launched ... I realize this may not be the ideal group in which to post this; ... However, I would request indepth ...
    (comp.os.linux.misc)
  • Re: How to Link???
    ... You should have told that you're using Cygwin. ... Cygwin does not fit directly into the Windows directory tree - ... the root is different and the way of specifying the drives. ... tauno voipio iki fi ...
    (comp.os.linux.development.apps)