Discussion:
Run task on last Friday of the month
Thibault Godouet
2011-03-12 12:36:54 UTC
Permalink
Hi Carsten,

Apologies for the late answer...
There is no specific support for what you would like to do, however you
can achieve your goal with multiple lines.

You could perhaps use something as:

0 1 25-31 1,3,5,7,8,10,12 5 /bin/true
0 1 22-28 2 5 /bin/true
0 1 24-30 4,6,9,11 5 /bin/true

You should be able to adapt that for say the first friday of the month
quite easily, and similar variants as well.

I will concede a single line would be nicer, but at least you have a
working solution there!

Regards,
Thibault.
Hi,
I really ask myself: did I overlook something in the documentation (of
the variouls cron implementations)
or is it not possible to run something for example on every last friday
of the month
(could also be the first friday, month could be year or other intervall
of course).?
Why does nobody have this feature implemented or did I not understand
the documentation correctly?
If not, it would be a nice feature suggestion for a future release.
Regards
Carsten
Brad Huntting
2011-03-12 15:34:04 UTC
Permalink
But note that this solution won't run on leap day.

On Mar 12, 2011 5:37 AM, "Thibault Godouet" <***@free.fr> wrote:

Hi Carsten,

Apologies for the late answer...
There is no specific support for what you would like to do, however you can
achieve your goal with multiple lines.

You could perhaps use something as:

0 1 25-31 1,3,5,7,8,10,12 5 /bin/true
0 1 22-28 2 5 /bin/true
0 1 24-30 4,6,9,11 5 /bin/true

You should be able to adapt that for say the first friday of the month quite
easily, and similar variants as well.

I will concede a single line would be nicer, but at least you have a working
solution there!

Regards,
Thibault.
Hi,
I really ask myself: did I overlook something in the documentation (of
the variouls cron implementations)
or is it not possible to run something for example on every last friday
of the month
(could also be the first friday, month could be year or other intervall
of course).?
Why does nobody have this feature implemented or did I not understand
the documentation correctly?
If not, it would be a nice feature suggestion for a future release.
Regards
Carsten
-------------------------------------------------------------------------------
- Fcron user support mailing list - http://fcron.free.fr
To unsubscribe from the mailing list fcronsupport :
mailto:fcronsupport-***@ml.free.fr?subject=unsubscribe

*******

Liste de diffusion fcronsupport
Pour se désinscrire : mailto:fcronsupport-***@ml.free.fr
?subject=unsubscribe
Brad Huntting
2011-04-01 16:46:25 UTC
Permalink
I was reminded of this issue just recently while I was writing some code to
produce recurring iCalendar events. RFC5545 section
3.3.10<http://tools.ietf.org/html/rfc5545#section-3.3.10> describes
a very flexible system for specifying recurring events. For example, the
last Friday of the month can be specified as:

FREQ=MONTHLY;BYDAY=-1FR


In addition, iCalendar provides for specifying recurring events based on
arbitrary time zone specifications so they follow the correct daylight
savings time change. For example if you're in the US, but you need to run a
daily cron job that can only be run during the 1 hour window when your bank
in Frankfurt bank does offline backups.

And of course, iCalendar also allows non-recurring events (a la atrun(8)).

Of course, iCalendar doesn't have the external signals like load average,
and job concurrency counts. And it's not intended (as far as I can tell) to
handle the fuzzy-frequency scheduling (%hourly, %weekly, etc) that fcron
really excels at.

Implementing a scheduler like this would probably require a complete rewrite
of most of fcron's core. The reliability issues are difficult enough with
plain old cron. Adding this level of functionality would require very
defensive coding and gratuitous use of unit tests.

Is it worth it?


brad
Post by Thibault Godouet
Hi Carsten,
Apologies for the late answer...
There is no specific support for what you would like to do, however you can
achieve your goal with multiple lines.
0 1 25-31 1,3,5,7,8,10,12 5 /bin/true
0 1 22-28 2 5 /bin/true
0 1 24-30 4,6,9,11 5 /bin/true
You should be able to adapt that for say the first friday of the month
quite easily, and similar variants as well.
I will concede a single line would be nicer, but at least you have a
working solution there!
Regards,
Thibault.
Hi,
I really ask myself: did I overlook something in the documentation (of
the variouls cron implementations)
or is it not possible to run something for example on every last friday
of the month
(could also be the first friday, month could be year or other intervall
of course).?
Why does nobody have this feature implemented or did I not understand
the documentation correctly?
If not, it would be a nice feature suggestion for a future release.
Regards
Carsten
-------------------------------------------------------------------------------
- Fcron user support mailing list - http://fcron.free.fr
*******
Liste de diffusion fcronsupport
?subject=unsubscribe
Thibault Godouet
2011-04-03 09:47:03 UTC
Permalink
Hi Brad,

Interesting indeed... implementing something like this in fcron would
clearly be powerful, but as you said it would be almost completely
different to the existing code. That would be quite a major undertaking...

To my mind it makes sense to first finish the current work to improve
fcron's compatibility to vixie cron further, use the alternative
mechanism for fcrondyn to authenticate without requiring the user to
type a password, and some internal rewrite to make the code neater.

Once this is done we'll be in a position to look at more adventurous
features indeed, if someone wants to give it a try!

Regards,
Thibault.
Post by Brad Huntting
I was reminded of this issue just recently while I was writing some code
to produce recurring iCalendar events. RFC5545 section 3.3.10
<http://tools.ietf.org/html/rfc5545#section-3.3.10> describes a very
flexible system for specifying recurring events. For example, the last
FREQ=MONTHLY;BYDAY=-1FR
In addition, iCalendar provides for specifying recurring events based on
arbitrary time zone specifications so they follow the correct daylight
savings time change. For example if you're in the US, but you need to
run a daily cron job that can only be run during the 1 hour window when
your bank in Frankfurt bank does offline backups.
And of course, iCalendar also allows non-recurring events (a la atrun(8)).
Of course, iCalendar doesn't have the external signals like load
average, and job concurrency counts. And it's not intended (as far as I
can tell) to handle the fuzzy-frequency scheduling (%hourly, %weekly,
etc) that fcron really excels at.
Implementing a scheduler like this would probably require a complete
rewrite of most of fcron's core. The reliability issues are difficult
enough with plain old cron. Adding this level of functionality would
require very defensive coding and gratuitous use of unit tests.
Is it worth it?
brad
Hi Carsten,
Apologies for the late answer...
There is no specific support for what you would like to do, however
you can achieve your goal with multiple lines.
0 1 25-31 1,3,5,7,8,10,12 5 /bin/true
0 1 22-28 2 5 /bin/true
0 1 24-30 4,6,9,11 5 /bin/true
You should be able to adapt that for say the first friday of the
month quite easily, and similar variants as well.
I will concede a single line would be nicer, but at least you have a
working solution there!
Regards,
Thibault.
Hi,
I really ask myself: did I overlook something in the
documentation (of
the variouls cron implementations)
or is it not possible to run something for example on every last friday
of the month
(could also be the first friday, month could be year or other intervall
of course).?
Why does nobody have this feature implemented or did I not understand
the documentation correctly?
If not, it would be a nice feature suggestion for a future release.
Regards
Carsten
-------------------------------------------------------------------------------
- Fcron user support mailing list - http://fcron.free.fr
*******
Liste de diffusion fcronsupport
Max Kremmel
2011-04-03 18:54:25 UTC
Permalink
You can always use remind to run tasks at complicated calendar based
intervals. It has a RUN command, which will allow you to do what you
wish.

Such a line in a remind calendar type reminder would look like:
REM Fri 1 -7 RUN command

For those of you with an interest:
http://www.roaringpenguin.com/products/remind

x
Post by Thibault Godouet
Hi Brad,
Interesting indeed... implementing something like this in fcron would
clearly be powerful, but as you said it would be almost completely
different to the existing code. That would be quite a major undertaking...
To my mind it makes sense to first finish the current work to improve
fcron's compatibility to vixie cron further, use the alternative
mechanism for fcrondyn to authenticate without requiring the user to
type a password, and some internal rewrite to make the code neater.
Once this is done we'll be in a position to look at more adventurous
features indeed, if someone wants to give it a try!
Regards,
Thibault.
Post by Brad Huntting
I was reminded of this issue just recently while I was writing some code
to produce recurring iCalendar events. RFC5545 section 3.3.10
<http://tools.ietf.org/html/rfc5545#section-3.3.10> describes a very
flexible system for specifying recurring events. For example, the last
FREQ=MONTHLY;BYDAY=-1FR
In addition, iCalendar provides for specifying recurring events based on
arbitrary time zone specifications so they follow the correct daylight
savings time change. For example if you're in the US, but you need to
run a daily cron job that can only be run during the 1 hour window when
your bank in Frankfurt bank does offline backups.
And of course, iCalendar also allows non-recurring events (a la atrun(8)).
Of course, iCalendar doesn't have the external signals like load
average, and job concurrency counts. And it's not intended (as far as I
can tell) to handle the fuzzy-frequency scheduling (%hourly, %weekly,
etc) that fcron really excels at.
Implementing a scheduler like this would probably require a complete
rewrite of most of fcron's core. The reliability issues are difficult
enough with plain old cron. Adding this level of functionality would
require very defensive coding and gratuitous use of unit tests.
Is it worth it?
brad
Hi Carsten,
Apologies for the late answer...
There is no specific support for what you would like to do, however
you can achieve your goal with multiple lines.
0 1 25-31 1,3,5,7,8,10,12 5 /bin/true
0 1 22-28 2 5 /bin/true
0 1 24-30 4,6,9,11 5 /bin/true
You should be able to adapt that for say the first friday of the
month quite easily, and similar variants as well.
I will concede a single line would be nicer, but at least you have a
working solution there!
Regards,
Thibault.
Hi,
I really ask myself: did I overlook something in the
documentation (of
the variouls cron implementations)
or is it not possible to run something for example on every last friday
of the month
(could also be the first friday, month could be year or other intervall
of course).?
Why does nobody have this feature implemented or did I not understand
the documentation correctly?
If not, it would be a nice feature suggestion for a future release.
Regards
Carsten
-------------------------------------------------------------------------------
- Fcron user support mailing list - http://fcron.free.fr
*******
Liste de diffusion fcronsupport
-------------------------------------------------------------------------------
- Fcron user support mailing list -
http://fcron.free.fr
*******
Liste de diffusion fcronsupport
Loading...