Home

 

Add scheduled tasks

Use SearchService administrative commands to add scheduled task definitions to the Home page database.


To use SearchService administrative commands, use wsadmin. See Start the wsadmin client for information about how to start the wsadmin command-line tool.

The SearchService commands are used to access a service that provides an administrative interface for adding scheduled indexing task definitions to the Home page database. The following features can be indexed: Activities, Blogs, Bookmarks (previously known as Dogear), Communities, Files, Profiles, and Wikis.

When defining a scheduled task in the Home page database, you need to specify when the scheduler starts the task. The schedule is defined using a Cron schedule. A Cron schedule has six parts, each separated by a space. The six parts specify "second minute hourOfDay DayOfMonth Month DayOfWeek" respectively. "*" means all values, for example, all days of the week. The seconds must always be specified as zero. For example, "0 30 3 ? * *" means that the indexing task is run daily at 3:30 a.m. "0 30 2 ? * SUN" means that the task is run on Sunday mornings at 2:30 a.m.

It is not possible to specify an end time for an indexing task. All tasks run as long as they need to. The startby interval defines the time period by which a task can fire before it is automatically canceled. This mechanism ensures that tasks do not queue up for an overly long period before being canceled, and allows for tasks than run for longer than the default indexing schedule, such as initial index creation.

For more information about the Cron format, go to: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/scheduler/UserCalendar.html To define a scheduled task in the Home page database...

  1. Open a command window and start the wsadmin command-line tool.

  2. After the wsadmin command environment has initialized, use one of the following commands to initialize the search environment and start the search script interpreter:

    When asked to select a server, you can select any server.

  3. Use the following commands to add scheduled task definitions in the Home page database:


    SearchService commands for adding scheduled tasks

    Command Description
    SearchService.addIndexingTask(String taskName, String schedule, String startBy, String featureNames, Boolean optimizeFlag) Creates a new scheduled indexing task definition in the Home page database.This command takes the following arguments:

    • taskName. The name of the scheduled task. This argument is a string value, which must be unique.

    • schedule. The time at which the scheduled task starts. This argument is a string value that must be specified in Cron format.

    • startBy. The time given to a task to fire before it is automatically canceled. This argument is a string value that must be specified in Cron format.

      This parameter should be used to ensure that indexing tasks are not queued up and running into server busy times. Under normal conditions, the only factors that might cause a task to be delayed are that overlapping or coincident tasks are trying to fire at the same time, or an earlier task is running for a long time.

    • featureNames. The name (or names) of the IBM Lotus Connections feature to be indexed when the task is triggered. This argument is a string value. To index multiple features, use a comma-delimited list. The following values are valid: activities, blogs, communities, dogear, files, profiles, and wikis.

    • optimizeFlag. A flag that indicates if an optimization step should be performed after indexing. This argument is a boolean value.

    All arguments are required. For example:

      SearchService.addIndexingTask("mine", "0 0 1 ? * MON-FRI", "0 10 1 ? * MON-FRI", "dogear,blogs","true")
      

    The refreshTasks() command should be used after this command for the new task definitions to take effect immediately. Otherwise, the changes take place when the search feature is next restarted.

    SearchService.addOptimizeTask(String taskName, String schedule, String startBy) Creates a new index optimization scheduled task definition.This command takes the following arguments:

    • taskName. The name of the scheduled task. This argument is a string value, which must be unique.

    • schedule. The time at which the scheduled task starts. This argument is a string value that must be specified in Cron format.

    • startBy. The time given to a task to fire before it is automatically canceled. This argument is a string value that must be specified in Cron format.

      This parameter should be used to ensure that indexing tasks are not queued up and running into server busy times. Under normal conditions, the only factors that might cause a task to be delayed are that overlapping or coincident tasks are trying to fire at the same time, or an earlier task is running for a long time.

    All arguments are required. For example:

      SearchService.addOptimizeTask("yours", "0 0 1 ? * MON-FRI", "0 10 1 ? * MON-FRI")
      

    The refreshTasks() command should be used after this command for the new task definitions to take effect immediately. Otherwise, the changes take place when the search feature is next restarted.

  4. To refresh the Home page database to include the newly-added tasks...

    SearchService.refreshTasks


Configure scheduled tasks

 

Related reference


SearchService commands


+

Search Tips   |   Advanced Search