web stats
Mirth Community - View Single Post - Mirth Tools: User defined functions
View Single Post
Old 07-30-2012, 09:54 AM
Bostad Bostad is offline
Level 85 Channel Wizard
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Smile Daily Scheduler

I've seen people ask for the ability to schedule a channel to only run on certain days of the week.

I've come up with a 2-part solution.

The first part:

In the deploy script of every channel you wish to schedule:
//This goes into the scheduled channels Deploy Script

//change the days you wish your channel to run into the next line using the first 2 letters of the each day separated by ~

var strSched = channelId + ',Mo~We~Fr';

var fname = channelId + '_sched.sch';

//in the line below you will need to change the 'folders/files/Channels/' to a folder reachable from your Mirth Server

FileUtil.write('/folders/files/Channels/' + fname, false, strSched);

//make sure the return; command is below this line!

This will write a text file with the extension .sch in the folder you specify.

That file will be used by the attached channel which is set to run just after midnight.

If you need to run the controller channel at other times, simply "Deploy Channel".
Attached Files
File Type: xml Channel Scheduler.xml (11.5 KB, 250 views)
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com

Test all my code suggestions prior to implementation
Reply With Quote