Cronos icon indicating copy to clipboard operation
Cronos copied to clipboard

Feature Request: Support an array of cron expressions

Open mattheys opened this issue 3 years ago • 0 comments

My users have just asked if they can change the current schedule of every 30 mins between 10am and 5pm to also include 5pm.

I can't see a way of doing this without also including 5:30pm therefore i would like to have an array of two expressions built into one so that GetNextOccurrence will get the next one from either expression.

            var expressions = new string[]
            {
                "0,30 10-16 * * 1-5", 
                "0 17 * * 1-5"
            };
            var cronosExpression = CronExpression.Parse(expressions);

I've reworked my app to handle this in my IHostedService manually but there might be others who will need something like this in the future too, it's easy enough to do in a Linux crontab because you just run the same script twice.

0,30 10-16 * * 1-5  /opt/example.sh
0 17 * * 1-5        /opt/example.sh

mattheys avatar May 31 '22 11:05 mattheys