6

I am using Sitecore.NET 7.2 (rev. 140228).

For my project schedule publishing is in place. In weekends I have a separate job which creates over 100k items and this job publishes all the items after creation programmatically. So, I want to stop my regular schedule publishing as my publishing struck as both publishing happening simultaneously in weekend.

Could anyone suggests how to stop my schedule publishing only in weekends?

2 Answers 2

13

This can be achieved by updating your Schedule field on your task.

enter image description here

127 represents the days of the week, this task is meant to run. This only makes sense if you convert it to binary.

127d = %01111111

Each of the bits represent a day of the week. Like this.

-SFTWTMS
01111111

So to disable the tasks for the weekend, change it to:

-SFTWTMS
00111110

%00111110 = 62d

enter image description here

See also: How to create Sitecore Scheduled Task

6

Disable your default publishing in web.config

<agent type="Sitecore.Tasks.PublishAgent" method="Run" interval="00:00:00">

Override Sitecore.Tasks.PublishAgent

<agent type="YourMethod, YourClass" method="Run" interval="01:00:00" ><br>
  <param desc="source database">master</param>
  <param desc="target database">targetDB</param>
  <param desc="mode (full or smart or incremental)">incremental</param>
</agent>

put your custom conditions in run method

public void Run()
    {
        DayOfWeek day = DateTime.Now.DayOfWeek;
        if (day != DayOfWeek.Saturday && day != DayOfWeek.Sunday)
        {
            this.StartPublish(this._languages);
        }
    }

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.