Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


BjornF
2015-05-04T12:24:45Z
Hi,
I'm trying to set up a time exception for a scheduled job. We have a scheduled file export that runs every other hour all days of the week, year round.
The problem is that we also have a server service window scheduled for every last sunday of the month between 4 am and 8 am.

How do I set up an time exception or condition for the job to run every sunday except the last sunday of the month?

I could set up a time exception for every sunday, but then the export wouldn't run 3-4 times during a month when it is supposed to.
Sponsor
Forum information
ErikC
2015-05-04T13:30:05Z
Hi Bjorn,

Welcome to the forum!

Setting up a time exception like this is not possible at the moment.
To get the functionality you want, you could use some .NET code :

using System;

public class Test
{
 public static bool LastSundayOfMonth()
 {
	DateTime now = DateTime.Now; 
	int daysInMonth = DateTime.DaysInMonth(now.Year, now.Month);
	if (now.DayOfWeek == DayOfWeek.Sunday && daysInMonth - now.Day < 7 && now.Hour > 4 && now.Hour < 😎        
		return true ;            
	else
		return false ;
 }
}

With the output of this task you can use a condition to stop the job when the result of the .NET task is True.

Regards,
Erik
Uses Visualcron since 2006.
Support
2015-05-04T13:37:57Z
Thanks for the great workaround Erik - I am moving this topic to Feature requests - to add the same kind of support for Interval as in time trigger.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top