This is a simple scala cron parser used for parsing some cron parameters and output result in a specific format.
- You'll need
scala 2.13
- You'll need
scalatest
andscalactic
for running the tests.
-
This is sbt based project, you can import and build it in IntelliJ.
-
runner
is simple bash for running your build output from SBT. -
runner
takes 6 parameters in this order: Minute, Hour, DayOfMonth, Month, DayOfWeek, Command.$ ./runner 2 3 */5 1-5 \* /lib/exec minute 2 hour 3 day of month 1 6 11 16 21 26 month 1 2 3 4 5 day of week 1 2 3 4 5 6 7 command /lib/exec
Note: Make sure to skip the
*
in the terminal as shown above. -
If there is any parsing error, it will throw an
IllegalArgumentException
.
java.lang.IllegalArgumentException: requirement failed: Found: List(2, 3, */5, 1-5, *, /lib/exec, ds)
Please provide all 6 parameters: minute, hour, day of month, month, day of week, command
*/-,
and numbers are allowed in the parameters.- Fixed months to be 30 days long.
- Comma separated patterns. e.g
1-5,6/10
*
in values e.g1*-20
- Written Days patterns in the Day of the week e.g
SUN,MON
. - Written Months patterns e.g
JAN,FEB
. - Years parameters.
- Extra special characters like
LWC#?
.