Using ACF, I was able to use a cron tab to run a task every minute, but have it run at 30 seconds into the minute. I’m trying to stagger a couple of tasks that I want to run once every 60 seconds, but I don’t want them to all start at the same time. I want to stagger the trigger time.
This was the cron expression I’m using in ACF: 30 * * ? * * *
Is there a way to duplicate this behavior in Lucee 5.3.9.133?
Try this:
schedule
task="Every minute starting 30 seconds in"
action="update"
operation="HTTPRequest"
interval="60"
startdate=Now().DateFormat( "yyyy-mm-dd" )
starttime="00:00:30"
url="http://mytaskUrl/";
The key attribute is the starttime
.
Thanks!
I hadn’t seen any examples showing HH:MM:SS
as being valid for the starttime
so I didn’t know that would work. This is exactly what I need!
Do you know if you can combine endtime
with starttime
if to run something that only runs between certain hours of the day? For example, if I wanted something to run from 8am to 5pm, could I use:
schedule
task="Every minute starting 30 seconds in"
action="update"
operation="HTTPRequest"
interval="60"
startdate=Now().DateFormat( "yyyy-mm-dd" )
starttime="08:00:00"
endtime="17:00:00"
url="http://mytaskUrl/";
Just tested and yes that should work.