Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 59: Support crontab ranges 'x-y' and 'x/y' #49

Merged
merged 2 commits into from
Jul 8, 2016

Conversation

ohinckel
Copy link
Member

(copied from mknx/smarthome#61)

I started to refactor the scheduler._range() function a little bit and implemented support for x/y and x-y as requested in issue #59. The function was changed to resolve the crontab elements from complex to simple elements.

The following complex elements are supported now in crontab setting:

  • list, e.g. 1,2,3,4,8-10
  • intervals, e.g. */2
  • ranges, e.g. 0-8

Since the resolving is implemented in a recusive way, it's also possible to combine all of them. E.g. you can use 1,2,3,4,8-10 or 1-4,5-23/2 or something similar. The first one will include the hours between 1-4 and 8-10, the second one will include the hours between 1-4 and each even hour between 5 and 23.

  . add support for interval specification using "/x"
  . add support for range specification using "x-y"
  . refactor a little bit to have one block which handles a single
  item, which is used recursively when using ",", "/x" or "x-y"
# implements suggestion of issue smarthomeNG#59
- log exception message when error occurs while analyzing the crontab
  entry
@cstrassburg
Copy link
Member

cstrassburg commented Jul 4, 2016

Hey, ich würde das gerne mergen, oder hat jemand etwas dagegen?
Einzig die Doku fehlt.

@psilo909
Copy link
Contributor

psilo909 commented Jul 5, 2016

in den DEV oder? für mich ok, kann mir auch einen use case zum testen überlegen...

@cstrassburg
Copy link
Member

ja develop

@bmxp
Copy link
Member

bmxp commented Jul 7, 2016

Auf den ersten Blick ist mir nichts aufgefallen was dem entgegen spräche. Ich fände das gut ranges (-) zu haben und auch wiederkehrende Intervalle (/) zu haben. Evtl. könnte man später noch @Yearly, @monthly etc. implementieren.

@cstrassburg cstrassburg merged commit abb9d47 into smarthomeNG:develop Jul 8, 2016
@ohinckel ohinckel deleted the issue-59-crontab-ranges branch September 4, 2016 19:29
cstrassburg pushed a commit that referenced this pull request Dec 10, 2016
* - change _range() function in sheduler:
  . add support for interval specification using "/x"
  . add support for range specification using "x-y"
  . refactor a little bit to have one block which handles a single
  item, which is used recursively when using ",", "/x" or "x-y"
# implements suggestion of issue #59
- log exception message when error occurs while analyzing the crontab
  entry

* - remove list handling of basic items in _range(), which is already
  done in the top part of the function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants