Skip to content

Scheduling Session Pools

You can set up a schedule that automatically starts, stops, or restarts the session pool. To create a schedule, from the Session Server Explorer, select the pool you want to schedule, right-click Properties, and choose Schedule.

A pool can support multiple schedules.

Creating a Schedule

  1. In the right pane of the Schedule property page, click Add. The Add Schedule dialog box displays.

  2. Provide a meaningful name and description for the schedule.

  3. Select which command you want the schedule to execute; Start, Stop, or Restart.

  4. Select Force stop/restart to ignore the status of the pool when stopping or restarting. By default, if a pool contains a number of sessions (one of which is in use and running, while the others are idle) and a stop event is scheduled, the idle sessions will be stopped. However, the session in use will be allowed to finish it's task before being stopped. If you check Force stop/restart the session is stopped regardless of its status.

  5. Set the date and time for the scheduled event. You can either choose to select the exact day of the month for the event, or set up an ongoing event, such as the second Tuesday of the month. As you choose the date and time a Cron expression is built in the Cron expression field.

  6. Select Enable and click OK to activate the schedule.

After scheduling a task, the schedule, including its values, displays in the Schedule table. You can enable and disable the scheduled task from this table using the Enabled column check box.

Creating your own Cron expression

Cron expressions are strings that you can use to create and trigger schedules to execute a routine, such as: "At 10:00 am every Tuesday". Cron is a UNIX tool that has well-tested scheduling capabilities.

You can use the Add Schedule dialog box to build your Cron expression, or you can manually write your own expression in the Cron expression field.

Cron expression details are available on the Internet. Here are a few basic examples and formatting information.

Format

Cron expressions are strings that consist of 6 or 7 fields separated by white space. There are allowed values for each field and special characters that you can also use.

Field name UIs the field mandatory? Supported values Supported special characters
Seconds Yes 0-59 , - * /
Minutes Yes 0-59 , - * /
Hours Yes 0-23 , - * /
Day of the month Yes 1-31 , - * ? / L W C
Month Yes 1-12 or JAN-DEC , - * /
Day of the week Yes 1-7 or SUN-SAT , - * ? / L C #
Year No empty, 1970-2099 , - * /

Note

In a Cron expression forward slashes denote increments of time. For example, 1 / 2 in the Months field indicates January and every 2 months thereafter. You cannot use the text equivalent of the month (JAN) to express the same message. While the dialog box will accept JAN / 2, it does not actually schedule the event.

Special Characters

  • Use # ** ("all values") to select all values within a field. For example, "" in the minute field means "every minute". The names of the months and days are not case sensitive.

  • If you are setting firing times between midnight and 1:00 am, be aware that daylight savings can cause problems when the time moves forward or back.

  • The C character is not fully implemented in Cron, but specifies that the values are to be calculated against an associated calendar, if there is one. "1C" in the day-of-week field means "the first day included by the calendar on or after Sunday".

  • You can enter unsupported characters in the Cron field, however the scheduler will ignore any portion of the expression that follows the unsupported character. For example, x x x @ x x, where x is a supported character and @ is not, the scheduler will read x x x.

See examples for a more detailed explanation.

Special character Description
* An asterisk indicates that the cron expression matches for all values of the field. For example, using an asterisk in the 4th field (month) indicates every month.
Minutes ?* No specific value.
Hours -* Specifies ranges. "9-11" in the hour field means 'the hours 9,10, and 11'.
Day of the month ,* Specifies additional values. "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday".
Month /* Specifies increments. "0/15" in the seconds field means "the seconds 0, 15, 30, and 45".
Day of the week L* ("last") Specifies different things depending on the field in which it is used. "L" in the day-of-month field means "the last day of the month" (day 31 for January, day 28 for February on non-leap years).Used alone in the day-of-week field, it means "7" or "SAT". However if you use it in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last Friday of the month". When you use the 'L' option do not specify lists or ranges of values to avoid confusing results.
Year #* Specifies 'the nth' XXX day of the month. '6#3' in the day-of-the-week field means the third Friday of the month (day 6 = Friday, #3 = the third one in the month). '4#5' means the fifth Wednesday of the month.
W (weekday) Specifies the weekday (Monday-Friday) nearest the given day. '15W' in the day-of-the-month field means the nearest weekday to the 15th of the month. If the 15th is a Saturday, the trigger will fire on Friday the 14th.

L and W characters can be combined in the day-of-the-month field ('LW') which means the last weekday of the month.

The question mark ( ? ) is a non-standard character. It is used instead of '*' for leaving either day-of-month or day-of-week blank.

Examples:

Expression Schedule Trigger Description 
0 0/5 14,18 * * ?  Every 5 minutes starting at 2 pm and ending at 2:55 pm, AND every 5 minutes starting at 6 pm and ending at 6:55 pm, every day  
0 15 10 ? * MON-FRI 10:15 am every Monday, Tuesday, Wednesday, Thursday and Friday  
0 15 10 * * ?  10:15 am every day  
0 15 10 15 * ?  10:15 am on the 15th day of every month  
0 10 10 10 10 ?  Every October 10th at 10:10 am

More information