While not yet available in the FireDaemon Pro user interface, it is possible to create advanced schedules that can start or stop a service on certain dates or periods of days in a year.
Sections
- Background
- Concepts and Properties of a Schedule (XML)
- Fixed Annual Calendar Dates
- Dates that Fall on a Weekend
- Inauguration Day
- A Daily Restart Schedule
- The Complete Schedule
Background
Since FireDaemon Pro v4.0, scheduling has become more powerful and accurate than in the previous versions.
Although the user interface currently only supports schedules that revolve around a day or weekdays, FireDaemon Pro's underlying scheduling engine and data-model allow for more advanced scheduling strategies such as yearly repeating schedules.
FireDaemon Pro 4.5 introduced several new scheduling features:
- A new schedule type, Halt schedules, as an addition to the regular Start / Restart and Duration schedule types.
- Scheduling on the "nth day of the week in a month", which supports actions that must occur on variable dates such as the "3rd Monday of January".
- The ability to import schedule definitions, including advanced schedule definitions, via XML files created outside of FireDaemon Pro.
The following sections illustrate how to implement a set of schedules that collectively define the standard U.S. federal holidays in a year. The schedule is divided into three pieces, plus a supplementary fourth piece that performs a daily service restart.
Concepts and Properties of a Schedule (XML)
Let's take a look at a single Halt schedule represented in XML:
<!-- 1. --> <fds:schedules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fds="http://xml.firedaemon.com/scheduling/v3" xmlns:fd="http://xml.firedaemon.com"> <!-- 2. --> <schedule name="New Year's Day" fd:fixed_duration_as="downtime"> <!-- 3. --> <interval xsi:type="fds:attributive_interval" granularity="year_interval" length="1" blueprint="fixed_subrange_duration"> <!-- 4. --> <onset name="New Year's Day"minute="0" hour="4" monthday="0" month="0"/> <onset minute="0" hour="4" monthday="0" month="0"/> </interval> <!-- 5. --> <activity_boundary/> </schedule> </fds:schedules>
Notes:
- Multiple schedules can be defined in a single XML file.
- The schedule is defined by time points, named onsets, that denote either a restart, an uptime period, or a downtime period.
Naming a schedule is optional, but recommended when running multiple schedules for one service.
Schedule types are distinguished simply by theirfd:fixed_duration_as
setting, as followsfd:fixed_duration_as="downtime"
(a Halt schedule)fd:fixed_duration_as="uptime"
(a Duration schedule) (default) - Different intervals can be selected - by the second, minute, hour, day, week, month, year, or leap year.
In this scenario, the goal is to implement an annual holiday schedule, so a yearly interval setting is appropriate - the interval's granularity attribute is set to "year_interval".
The "blueprint" attribute defines how to treat the list of onsets. In this scenario, "fixed_subrange_duration" indicates that the onsets are given in pairs to define a time interval. See XML Tags in Service Definition for other options.
- An
<onset>
tag defines a moment in time.
An onset's attributes (second, minute, ...) define when the action is to occur, counted from the beginning of the interval, e.g. from the beginning of the year for a yearly schedule.
For restarts, only a single onset is needed.
For uptime or downtime periods, two onsets are used to define two points in time. For an uptime (Duration) schedule, the service will be started at the first onset time and stopped at the second onset time. For a downtime (Halt) schedule, the opposite is true, i.e. the service will be stopped then later started.
- An
<activity_boundary>
tag constrains the schedule to a certain fixed period. This can be useful for various reasons, as illustrated in the following examples.
Note: All time range finishing points are considered to be outside the time interval.
Fixed Annual Calendar Dates
Below is an example of a schedule that defines a set of eight annual holidays, each of which occurs on a fixed calendar date every year. The schedule can be repeated every year, including leap years.
XML fragment - Annual Regular US Federal Holidays
<fds:schedules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fds="http://xml.firedaemon.com/scheduling/v3" xmlns:fd="http://xml.firedaemon.com"> <!-- US Federal Holidays on "nth day of week in a month" --> <schedule name="Annual, Regular US Federal Holidays" fd:fixed_duration_as="downtime"> <interval xsi:type="fds:attributive_interval" granularity="year_interval" length="1" blueprint="fixed_subrange_duration"> <onset name="New Year's Day" minute="0" hour="4" monthday="0" month="0"/> <onset minute="0" hour="4" monthday="0" month="0"/> <onset name="Martin Luther King, Jr. Day" minute="0" hour="4" month="0" weekday="0" first_dow="0" nth_kday_of_month="3"/> <onset minute="0" hour="4" month="0" weekday="0" first_dow="0" nth_kday_of_month="3"/> <onset name="George Washington’s Birthday" minute="0" hour="4" month="1" weekday="0" first_dow="0" nth_kday_of_month="3"/> <onset minute="0" hour="4" month="1" weekday="0" first_dow="0" nth_kday_of_month="3"/> <onset name="Memorial Day" minute="0" hour="4" month="1" weekday="0" first_dow="0" nth_kday_of_month="5"/> <onset minute="0" hour="4" month="1" weekday="0" first_dow="0" nth_kday_of_month="5"/> <onset name="Labor Day" minute="0" hour="4" month="8" weekday="0" first_dow="0" nth_kday_of_month="1"/> <onset minute="0" hour="4" month="8" weekday="0" first_dow="0" nth_kday_of_month="1"/> <onset name="Columbus Day" minute="0" hour="4" month="9" weekday="0" first_dow="0" nth_kday_of_month="2"/> <onset minute="0" hour="4" month="9" weekday="0" first_dow="0" nth_kday_of_month="2"/> <onset name="Thanksgiving Day" minute="0" hour="4" month="10" weekday="3" first_dow="0" nth_kday_of_month="4"/> <onset minute="0" hour="4" month="10" weekday="3" first_dow="0" nth_kday_of_month="4"/> </interval> </schedule> </fds:schedules>
Dates that Fall on a Weekend
Independence Day is an annual holiday that occurs on the 4th of July. Veterans Day is an annual holiday that occurs on the 11th of November.
When a federal holiday falls on a Saturday, it is usually observed on the preceding Friday. When it falls on a Sunday, it is usually observed on the following Monday.
Consequently, these holidays potentially fall on different calendar dates each year.
FireDaemon Pro does not support special holiday substitution rules, so it is necessary to fix the schedule to a specific year. The activity_boundary
tag performs this function.
XML fragment - 2022 US Federal Holidays
<fds:schedules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fds="http://xml.firedaemon.com/scheduling/v3" xmlns:fd="http://xml.firedaemon.com"> <!-- US Federal Holidays on certain days of the year. When a federal holiday falls on a Saturday, it is usually observed on the preceding Friday. When the holiday falls on a Sunday, it is usually observed on the following Monday. Because Independence Day and Veterans Day potentially fall at different dates each year, the schedule's period gets fixed to a certain year. --> <schedule name="2022 US Federal Holidays" fd:fixed_duration_as="downtime"> <activity_boundary from="2022-01-01T00:00:00" until="2023-01-01T00:00:00"/> <interval xsi:type="fds:attributive_interval" granularity="year_interval" length="1" blueprint="fixed_subrange_duration"> <onset name="Independence Day" minute="0" hour="4" monthday="3" month="6"/> <onset minute="0" hour="4" monthday="3" month="6"/> <onset name="Veterans Day" minute="0" hour="4" monthday="10" month="10"/> <onset minute="0" hour="4" monthday="10" month="10"/> <onset name="Christmas Day (Observed)" minute="0" hour="4" monthday="25" month="11"/> <onset minute="0" hour="4" monthday="25" month="11"/> </interval> </schedule> </fds:schedules>
Inauguration Day
This holiday occurs on the 20th January every four years, following a U.S. presidential election.
Additionally, the above rule for a federal holiday falling on a weekend applies (on a Saturday it is usually observed on the preceding Friday; on a Sunday it is usually observed on the following Monday).
Hence it is necessary to fix the schedule's period to a certain span of years. The activity_boundary
tag is set accordingly.
Note: The requirement to repeat the holiday every four years is represented by setting length="4" on the <interval>
tag.
XML fragment - 2021 and 2025 Inauguration Day
<fds:schedules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fds="http://xml.firedaemon.com/scheduling/v3" xmlns:fd="http://xml.firedaemon.com"> <!-- Inauguration Day. In addition to the ten annual federal holidays, Inauguration Day is an eleventh holiday designated by Congress for observance every four years on January 20 following a U. S. presidential election. It is only observed by government employees in Washington D.C. and the border counties of Maryland and Virginia. The schedule's start period must be fixed because it is repeating every 4 years. When a federal holiday falls on a Saturday, it is usually observed on the preceding Friday. When the holiday falls on a Sunday, it is usually observed on the following Monday. Because Inauguration Day potentially falls at different date every four years, the schedule's period gets fixed to a certain year. --> <schedule name="2021, 2025 Inauguration Day" fd:fixed_duration_as="downtime"> <activity_boundary from="2021-01-01T00:00:00" until="2029-01-01T00:00:00"/> <interval xsi:type="fds:attributive_interval" granularity="year_interval" length="4" blueprint="fixed_subrange_duration"> <onset name="Inauguration Day" minute="0" hour="4" monthday="19" month="0"/> <onset minute="0" hour="4" monthday="19" month="0"/> </interval> </schedule> </fds:schedules>
A Daily Restart Schedule
It is sometimes useful to restart a service daily. The schedule below restarts a service every day at 4:00 AM.
Note: A single restart schedule is sufficient to perform periodic restarts. Restarts only occur within uptime intervals and are ignored during downtime. So when this schedule is combined with the downtime schedules above, the service will not be restarted at 4:00 AM on the holiday days.
Hint: A restart schedule can be created or edited in FireDaemon Pro's user interface.
XML fragment - Restart daily at 4:00 AM
<fds:schedules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fds="http://xml.firedaemon.com/scheduling/v3" xmlns:fd="http://xml.firedaemon.com"> <schedule name="Restart daily at 4AM"> <interval xsi:type="fds:attributive_interval" granularity="day_interval" length="1" blueprint="evenly_clocked"> <onset minute="0" hour="4"/> </interval> </schedule> </fds:schedules>
The Complete Schedule
The individual schedules described above can be imported into FireDaemon Pro v4.5 either as separate XML files or as a single composite XML definition in a single file.
The schedule import function is accessed via the pulldown menu arrow button on the Service Definition toolbar. For further details, refer to Add Schedule.