Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have developed my own solution for this.</p> <p>First of all, modify your task to run every 1 minutes or so. It must run pretty frequently. Instead of forcing the task to run once, you make your task execute it's functionality at the time you like, and then wait untill the next day before executing the functionality again:</p> <p>In this example I force my task to run once between 03:00 am and 04:00 am:</p> <pre><code>public void Execute(Item[] itemArray, CommandItem commandItem, ScheduleItem scheduleItem) { if (!IsDue(scheduleItem)) return; // DO MY STUFF!! } /// &lt;summary&gt; /// Determines whether the specified schedule item is due to run. /// &lt;/summary&gt; /// &lt;remarks&gt; /// The scheduled item will only run between defined hours (usually at night) to ensure that the /// email sending will not interfere with daily operations, and to ensure that the task is only run /// once a day. /// Make sure you configure the task to run at least double so often than the time span between /// SendNotifyMailsAfter and SendNotifyMailsBefore /// &lt;/remarks&gt; /// &lt;param name="scheduleItem"&gt;The schedule item.&lt;/param&gt; /// &lt;returns&gt; /// &lt;c&gt;true&lt;/c&gt; if the specified schedule item is due; otherwise, &lt;c&gt;false&lt;/c&gt;. /// &lt;/returns&gt; private bool IsDue(ScheduleItem scheduleItem) { DateTime timeBegin; DateTime timeEnd; DateTime.TryParse("03:00:00", out timeBegin); DateTime.TryParse("04:00:00", out timeEnd); return (CheckTime(DateTime.Now, timeBegin, timeEnd) &amp;&amp; !CheckTime(scheduleItem.LastRun, timeBegin, timeEnd)); } private bool CheckTime(DateTime time, DateTime after, DateTime before) { return ((time &gt;= after) &amp;&amp; (time &lt;= before)); } </code></pre> <p>Check the article for more detailed information: <a href="http://briancaos.wordpress.com/2011/06/28/run-sitecore-scheduled-task-at-the-same-time-every-day/" rel="nofollow">http://briancaos.wordpress.com/2011/06/28/run-sitecore-scheduled-task-at-the-same-time-every-day/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload