Re: Scheduling Jobs - Last day of the month - HOWTO?
- From: Michal Vojan <mysutka@xxxxxxxxx>
- Date: Wed, 30 Aug 2006 22:50:05 +0200
I don't know exactly what your script is supposed to do but wouldn't that be
better to run the script on the first day of each month? When there is some
operation which is date related just subtract one day, omit data from
current day, etc. I find it better than think of those weird inteligentlike
constructions. Please, no offence, Chris. I just think that such scripts
are often sources of problems.
Michal Vojan
Chris F.A. Johnson wrote:
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.
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
}
.
- Follow-Ups:
- Re: Scheduling Jobs - Last day of the month - HOWTO?
- From: Chris F.A. Johnson
- Re: Scheduling Jobs - Last day of the month - HOWTO?
- References:
- Scheduling Jobs - Last day of the month - HOWTO?
- From: Michael B . Johnson
- Re: Scheduling Jobs - Last day of the month - HOWTO?
- From: Chris F.A. Johnson
- Scheduling Jobs - Last day of the month - HOWTO?
- Prev by Date: Re: Scheduling Jobs - Last day of the month - HOWTO?
- Next by Date: Re: Scheduling Jobs - Last day of the month - HOWTO?
- Previous by thread: Re: Scheduling Jobs - Last day of the month - HOWTO?
- Next by thread: Re: Scheduling Jobs - Last day of the month - HOWTO?
- Index(es):
Relevant Pages
|