You can use the ScheduledTaskManager to schedule tasks. In the vSphere Client, scheduled tasks display in the Task & Events tab.
ScheduledTaskManager and ScheduledTask Managed Objects shows the
ScheduledTaskManager service interface and associated data objects.
The ScheduledTaskManager.scheduledTask property contains an array of the
ScheduledTask objects configured for the server. If you have no actions scheduled, this property is empty. For any
ScheduledTask objects in this array, you can use the
info property of the
ScheduledTask object to obtain information about the status of the scheduled action. Information includes the task’s
progress,
state, previous and next runtimes, and other details contained in the
ScheduledTaskInfo data object.
If the action specified for a ScheduledTask creates its own
Task (such as with any of the asynchronous operations), the managed object reference to the
Task populates the
activeTask property of
ScheduledTaskInfo.
You create a ScheduledTask by invoking the
ScheduledTaskManager.CreateScheduledTask method. When you invoke the method, you include a
ScheduledTaskSpec object that defines the schedule and specifies the action to take at the specified time. A scheduled action applies to an object based on these rules:
The ScheduledTaskSpec data object contains all the information to create a
ScheduledTask.
The TaskScheduler base type has two properties:
TaskScheduler Data Object Subtypes provides some usage information about the
TaskScheduler subtypes. The examples in the table are Java code fragments.
|
|
|
Example: Schedule a task to run 10 minutes after vCenter Server startup.
|
|
|
Example: Schedule a task to run 30 minutes after the schedule is submitted to the server.
|
|
|
Base type for HourlyTaskScheduler, DailyTaskScheduler, WeeklyTaskScheduler, and MonthlyTaskScheduler objects. Set the interval property to define how frequently a task should run. For example, setting the interval property of an hourly task to 4 causes the task to run every 4 hours.
|
|
Example: Schedule a task to run every 4 hours at half-past the hour.
|
|
|
Example: Schedule a task to run daily at 9:30 am (EST).
|
|
|
Example: Schedule a task to run every Tuesday and Sunday at 30 minutes past midnight.
|
|
|
Example: Schedule a task to run every 3 months (on the last day of the month) at 12:30 p.m.
|
|
|
Example: Schedule a task to run on the last Wednesday of each month at 12:30 a.m.
|
|
The hour and
minute properties of all objects that extend the
RecurrentTaskSchedule data object are specified in Coordinated Universal Time (UTC) values rather than the local time of the server. When you define the schedule, convert your local time to a UTC value.
The code fragment in Example: Scheduled Task for Powering-on Virtual Machines defines a
ScheduledTask that powers on virtual machines daily at 4:15 a.m., if the server local time is in the Pacific Standard Time (PST) time zone. For a server in the Eastern European Summer Time (EEST) zone, the setting is read by the system as 3:15 pm.