Tutorial: Using Scripts with Schedules: Part 1
Overview
Schedules are one of the Limelight XE Console’s most dynamic and powerful tools. This is a brief tutorial on how to use the Console’s scripting feature to fully utilize this versatile feature.
Prerequisites
Schedules as Triggers
Each Schedule you create has a “Schedule GUID” which can be used as a property which is then called by a function in a script.
This means that Schedules can be used not only to control access but also as triggers for procedures or even triggers for other events/schedules.
A great example of this utility is provided in the sample code below:
// Default Limelight Javascript Shell
(()=>{ // main script begins...
// --- constants ---
// schedule GUID - copy from component tab / system managment / schedules
const scheduleGUID = '{A26D37E7-0D4A-4874-918E-583113DE50B7}';
var active = false;
// clear the console
console.clear();
console.log('Monitoring schedule changes');
// continue forever
while (true) {
// wait for a schedule to start
active = (ace.waitForProperty(ace.this.serverGUID, scheduleGUID, 'Active') == 'True');
if (active) {
console.log('Schedule active');
}
else {
console.log('Schedule inactive');
}
}
}
// end of main script
)(); // end of main script...
This script is written to trigger whenever the state of the schedule's 'Active' property specified by the scheduleGUID value changes.
The waitForProperty function then returns the current value when it is altered by the scheduling manager.
The second method allows a procedure to be triggered by a schedule which in turn can itself run a script.