Closed grosser closed 4 years ago
"2020-03-17 06:59:00 -0700"
is the right answer.
man 5 crontab
says:
Note: The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (ie, are not ), the command will be run when either field matches the current time. For example, ``30 4 1,15 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.
See also https://superuser.com/questions/428807/run-a-cron-job-on-the-first-monday-of-every-month
I think fugit can help in this way:
require 'fugit'
c = Fugit.do_parse_cron('59 6 * * 2#1')
c = Fugit.do_parse_cron('59 6 * * tue#1')
p c.next_time.to_s
# ==> "2020-04-07 06:59:00 +0900" for me
2#1
and tue#1
mean first Tuesday (of the month).
Unfortunately this was only documented in the mother project: https://github.com/jmettraux/rufus-scheduler#cronline-notations-specific-to-rufus-scheduler
I will close this issue when I have documented this here in fugit.
Thanks!
thx, this is awesome :)
... I was sure this is a valid syntax since I got it from a "how to do foo in cron" stackoverflow ... maybe there are different flavors of cron, or it was just wrong though :)
On Sat, Mar 14, 2020 at 4:35 PM John Mettraux notifications@github.com wrote:
"2020-03-17 06:59:00 -0700" is the right answer.
man 5 crontab says:
Note: The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (ie, are not ), the command will be run when either field matches the current time. For example, ``30 4 1,15 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.
See also https://superuser.com/questions/428807/run-a-cron-job-on-the-first-monday-of-every-month
I think fugit can help in this way:
require 'fugit' c = Fugit.do_parse_cron('59 6 2#1') c = Fugit.do_parse_cron('59 6 tue#1') p c.next_time.to_s
==> "2020-04-07 06:59:00 +0900" for me
2#1 and tue#1 mean first Tuesday (of the month).
Unfortunately this was only documented in the mother project: https://github.com/jmettraux/rufus-scheduler#cronline-notations-specific-to-rufus-scheduler
I will close this issue when I have documented this here in fugit.
Thanks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floraison/fugit/issues/35#issuecomment-599147841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACYZ7G3YF7TJEA3QFSQODRHQIEDANCNFSM4LJ3G3EQ .
Documentation done.
If there is anything unclear, please tell me or patch.
Closing, thanks!
the 1-7 constraint is ignored I got
"2020-03-17 06:59:00 -0700"
today