Code Monkey home page Code Monkey logo

Comments (10)

phibid avatar phibid commented on July 28, 2024 1

Aaaah, ok, just noticed that the default end is 1 day, sorry.

First tests done, seems promising !!

from croncal.

waldner avatar waldner commented on July 28, 2024

Agreed. I should find out how that plays together with the /n modifier, but I'll check it out.

from croncal.

waldner avatar waldner commented on July 28, 2024

I don't have access to a system that supports this syntax, could you provide an example of the semantics (if it's legal at all) of an expression like 1,2,3#2? Does it mean "the second monday and the second tuesday and the second wednedsay of the month" or does it mean "all mondays, all tuesdays and the second wednesday of the month"? What about 1-3#2? Also, how do you express "second and third monday of the month" (if it can be expressed)? Like so: 1#2,3 or like 1#2,1#3 ?

from croncal.

phibid avatar phibid commented on July 28, 2024

This cron syntax is for example used in Gitlab which uses fugit (https://github.com/floraison/fugit) to parse the cron syntax.

Those two links https://github.com/floraison/fugit#the-first-monday-of-the-month and https://github.com/floraison/fugit#the-hash-extension, explain the why and the how.

To reply to your questions:

1,2,3#2: All the Mondays, all the Tuesdays and the second Wednesday of each month
1-3#2: This syntax is not valid. You have to use instead 1#2,2#2,3#2
1#2,1#3: This will express the second and third Monday of each month
1#2,3: This will express the second Monday of each month and every Wednesday

So in resume, the hash can only be used after a day of the week. Hash does not support a range. If we want to specify several days, hash included, you have to use the usual coma separated list.

from croncal.

waldner avatar waldner commented on July 28, 2024

Excellent! Let me see what I can come up with.

from croncal.

waldner avatar waldner commented on July 28, 2024

Should be working now. Please try it and report any issues. Thanks!

from croncal.

phibid avatar phibid commented on July 28, 2024

Whoaaa, that was quick. A big thanks !

So now testing the script, I notice that I am unable to display the calendar. Tried on Ubuntu 20.04 and CentOS 7, but nevermind how I am testing it, this command don't display anything:

$ echo "30 0 * * 3 job1" | ./croncal.pl
$ 

If I try with a wrong formatted entry to stdin:

$ echo "dumb test" | ./croncal.pl 
Warning, skipping unrecognized crontab line 1: dumb test

Can see the error, so it seems that this is a print issue ?

Is it only me ? Am I doing something wrong here ?

from croncal.

waldner avatar waldner commented on July 28, 2024

Well, 3 as day of week means wednesday, the program by default uses now / now + 1 day as time interval, so since there's no wednesday in that time range, nothing is printed. If you expand the interval to include a wednesday, it works:

$ echo "30 0 * * 3 job1" | ./croncal.pl -s '2022-02-13 00:00' -e '2022-02-20 23:59'
2022-02-16 00:30|job1

from croncal.

waldner avatar waldner commented on July 28, 2024

Closing as I'm assuming that it's working fine for you. Feel free to reopen or add further comments if not.

from croncal.

phibid avatar phibid commented on July 28, 2024

Sorry for the late reply. I have implemented this new version, and so far so good, working like a charm it seems.

Thanks for your support !

from croncal.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.