Skip to content

Scheduling a monthly job

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • Atpa_Ken Offline
  • Posts: 5
  • Joined: Wed Jun 04, 2014 6:31 pm

Scheduling a monthly job

Post by Atpa_Ken »

For a job setup in the scheduler to run on the 30th day of every month, what does it do in February? Does it run the job on the last day of February or does it skip running the job in February at all? Or does it do something else entirely?
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Scheduling a monthly job

Post by Support_Rick »

Currently, the job would not execute if it was selected to run on the 30th day of the month. In that instance, it wouldn't work for February.

Same goes for 31st day of the month. Then, it would skip Feb, Apr, Jun, Sep & Nov.

The choice here would be to select the "Last day of the month", instead of specific day.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • Atpa_Ken Offline
  • Posts: 5
  • Joined: Wed Jun 04, 2014 6:31 pm

Re: Scheduling a monthly job

Post by Atpa_Ken »

That's what I figured and in most cases using Last day will work just fine. However, I do have a few cases where the desire is to schedule a job to run one or two days before the end of the month. That's how I fell into the 30th example and then realized the problem I was creating. Any further suggestions would be appreciated. Thanks.
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Scheduling a monthly job

Post by Support_Rick »

The best solution would be to create a Project and Schedule a Job to run Daily. If you need the project to run 2 days prior to Last day of the month, then put a statement inside the Project to determine the date and see if it should be executed. An example that shows the date could be like this:

-- Schedule "MyProject" to be executed daily

Code: Select all

<project name="MyProject" mainModule="Main" version="2.0">

  <variable name="DaysBeforeLast" value="2" />
  
	<module name="Main">

		<timestamp version="1.0">
			<format outputVariable="LastDay" pattern="dd" dayOfMonth="L" />
			<format outputVariable="Today"   pattern="dd" />
		</timestamp>

		<print version="1.0">
			<![CDATA[  
Day of Today:  ${Today}      
DayToRun:  ${LastDay - DaysBeforeLast}
Run Today?  ${if( Today == (LastDay - DaysBeforeLast), 'Yes', 'No' ) }
      ]]>
		</print>

		<if label="Check to see if running" condition="${Today ne LastDay-DaysBeforeLast}">
			<exitModule version="1.0" />
		</if>

<!-- Code goes here to process if running based on day of month match -->

	</module>
	
</project>
You'll get a joblog with something like the following (Based on Today's date):

Code: Select all

09/10/2014 15:51:26           INFO      Executing module 'Main'
09/10/2014 15:51:26           INFO      Executing task 'timestamp 1.0'
09/10/2014 15:51:26           INFO      Timestamp variable 'LastDay' was created and set to '30'
09/10/2014 15:51:26           INFO      Timestamp variable 'Today' was created and set to '10'
09/10/2014 15:51:26           INFO      Finished task 'timestamp 1.0'
09/10/2014 15:51:26           INFO      Executing task 'print 1.0'
09/10/2014 15:51:26           INFO        
                                        Day of Today:  10      
                                        DayToRun:  28
                                        Run Today?  No
                                              
09/10/2014 15:51:26           INFO      Finished task 'print 1.0'
09/10/2014 15:51:26           INFO      Entering if block labeled 'Check to see if running' as the condition "${Today ne LastDay-DaysBeforeLast}" was met
09/10/2014 15:51:26           INFO      Executing task 'exitModule 1.0'
09/10/2014 15:51:26           INFO      Exiting module 'Main'
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • Atpa_Ken Offline
  • Posts: 5
  • Joined: Wed Jun 04, 2014 6:31 pm

Re: Scheduling a monthly job

Post by Atpa_Ken »

I don't expect this to come up often, but thanks for the suggestion. I'll file it away in case I need it.

Thanks again!
Post Reply