Re: Scheduling Jobs - Last day of the month - HOWTO?
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Wed, 30 Aug 2006 12:07:20 -0400
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
.
- Follow-Ups:
- Re: Scheduling Jobs - Last day of the month - HOWTO?
- From: Michal Vojan
- Re: Scheduling Jobs - Last day of the month - HOWTO?
- From: Michael B . Johnson
- Re: Scheduling Jobs - Last day of the month - HOWTO?
- References:
- Scheduling Jobs - Last day of the month - HOWTO?
- From: Michael B . Johnson
- Scheduling Jobs - Last day of the month - HOWTO?
- Prev by Date: Re: Some bash questions :-)
- Next by Date: Memory restrictions
- Previous by thread: Scheduling Jobs - Last day of the month - HOWTO?
- Next by thread: Re: Scheduling Jobs - Last day of the month - HOWTO?
- Index(es):
Relevant Pages
|