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



Michael B. Johnson <mjohnson@xxxxxxxxxxx> writes:

On Wed, 30 Aug 2006 12:07:20 -0400, "Chris F.A. Johnson"
<cfajohnson@xxxxxxxxx> wrote:

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:

Actually this is fairly easy:

Just do something like this on February 28:

date --date=tomorrow | grep -q " Mar "

Even more, here is a way to check if this is the last day of the month:
(not checked)

month=$(date +'%h')
if ! date --date=tomorrow | grep -q " $month "; then
echo last day of the month
fi

Ensure that there is no collision with the month names anywhere.

Vilmos
.



Relevant Pages