I have looked at the documentation but I can't find anything that either confirms or denies that it's possible to run an agent every 48 or 72 hours for example.
From what I can see the longest interval for any out of the box agent is 24hrs.
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityDefinitely - all Sitecore does when reading in your agents is parse the interval as a TimeSpan via the following line of code, from the Sitecore.Tasks.Scheduler.ReadAgents
method:
TimeSpan timeSpan = DateUtil.ParseTimeSpan(XmlUtil.GetAttribute("interval", configNode), TimeSpan.FromSeconds(0.0), CultureInfo.InvariantCulture);
The Sitecore.DateUtil
method that is called to actually parse the interval is as follows:
public static TimeSpan ParseTimeSpan(string time, TimeSpan defaultValue, CultureInfo cultureInfo)
{
Assert.ArgumentNotNull((object) cultureInfo, "cultureInfo");
return DateUtil.ParseTimeSpan(time, cultureInfo) ?? defaultValue;
}
Sitecore's DateUtil.ParseTimeSpan
method includes a lot of custom parsing logic that adds support for custom syntaxes. All of the following are valid format strings:
"00:00:24" -> 24 seconds
"00:24:00" -> 24 minutes
"24:00:00" -> 24 hours
"1.00:00:00" -> 1 day (24 hours)
"1.24:00:00" -> 1 day and 24 hours (2 days or 48 hours)
Before you set such a long interval for your agents, have a look at the section "The Problem with Agents" in this post. It explains a major pitfall of scheduler agents that you should be aware of.
To summarize, the because agents cannot be attached to a particular time of day, the clock resets whenever the application restarts, meaning that as the duration of the interval increases so too does the likelihood that the agent will not run at all within the defined duration of the interval. This means that if your application restarts every 1-47 hours (due to a crash, app pool recycle, etc.) then your agent will never run at all.
If you are looking to set an agent to run at a longer interval, my first recommendation is that you assess to make sure that nothing will break if your agent doesn't run, that an agent really is the right tool for you to use and that you have logging set up so that you can always tell if and when your agent ran.