Expand my Community achievements bar.

SOLVED

WatchedFolder between 18PM and 8AM

Avatar

Former Community Member

Hi everyone,

I need to set a watched folder which will begin to scan the folder at 18PM and will stop at 8AM, even if there are still files to process.

I was hoping I could use the Repeat Count variable, (every 2 seconds for 1800 * 14 counts = 14 hours) but unfortunately the max value of Repeat Count is 100.

I did a little search, and it seems that the CRON expression doesn't allow this kind of demand.

Is there a way to do that ?

Can we ask a watched folder to start and stop working at a certain time ?

Kind regards,

Thomas

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I finally found how to do that by simply reading the CronTrigger doc !

Here's the link : http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html

My final CRON Expression is :

0/2 * 18-23,0-7 * * ?

Which means :

0/2 : every two seconds

* : every minutes

18-23,0-7 : from 6PM (18h) to 11PM (23h) and from 0AM to 8AM

* * ? : every day / every month / ...

Hope this helps !

I still have a question, Does this kind of configuration will consumn a lot of resource ?

Regards,

Thomas

View solution in original post

3 Replies

Avatar

Former Community Member

After a little more research, i may have found a solution :

CRON Expression : * 18-23,0-7 * * * -> Every minute between 18PM and 8AM.

Repeat Interval : 2 -> Every 2 seconds the folder is scanned

Repeat Count : 30 -> The folder is scanned 30 times (* 2s = 1 minute) at every cron expression.

I'll test that and let you know !

Avatar

Former Community Member

Hi again,

This doesn't work because after reading the documentation, it is specified that the "Repeat Interval" is ignored if we use a CRON Expression ...

I really don't know what to do know, I hope someone has an answer !

Regards,

Thomas

Avatar

Correct answer by
Former Community Member

I finally found how to do that by simply reading the CronTrigger doc !

Here's the link : http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html

My final CRON Expression is :

0/2 * 18-23,0-7 * * ?

Which means :

0/2 : every two seconds

* : every minutes

18-23,0-7 : from 6PM (18h) to 11PM (23h) and from 0AM to 8AM

* * ? : every day / every month / ...

Hope this helps !

I still have a question, Does this kind of configuration will consumn a lot of resource ?

Regards,

Thomas

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----