The procedures in this section indicate how to schedule a task, how to configure task notification, and how to configure task dependencies. All of the examples in this section assume that the commands are being run on the local host, using the default administration port (4444), and the local certificate configuration. If you are running the commands remotely, you might need to specify the certificate parameters. For more information, see Managing Administration Traffic to the Server.
To schedule a task, invoke the required utility with the options used to connect to the directory server, an optional start time, and any options that will be used as arguments for the task execution.
If the -t or --start option is provided, the utility exits immediately after scheduling the task. To schedule a task for immediate execution and have the utility exit immediately after scheduling the task, specify 0 as the value for the start time.
If the -t or --start option is omitted, the utility schedules the task for immediate execution and tracks the task's progress, printing log messages as they are available and exiting when the task has completed.
$ export-ldif -D "cn=directory manager" -w password \ -l /ldif-files/example.ldif --start 20080924121500 userRoot
To schedule a recurring task, invoke the required utility with the options used to connect to the directory server, specifying the recurring task schedule, and any options that will be used as arguments for the task execution. The following commands can be scheduled as recurring tasks:
The --recurringTask option specifies a recurring task schedule that is used by the task scheduler to determine when and how often a recurring task should run. The pattern used to specify the schedule is based on UNIX crontab(5) scheduling patterns and rules and includes the following five integer pattern fields, separated by blank spaces:
Day of the month [1,31]
Month of the year [1,12]
Day of the week [0,6] (with 0=Sunday)
Each of these patterns can be either an asterisk (meaning all valid values), an element, or a list of elements separated by commas. An element is either a number or two numbers separated by a dash (meaning an inclusive range).
The task scheduler spawns regular task iterations according to the specified schedule.
The following command schedules a backup task to execute at the beginning of every hour.
$ backup -D "cn=directory manager" -w password --recurringTask \ "00 * * * *" --backupDirectory /example/backup --backUpAll --backupID "Hourly Backup"
This example shows an export task that is scheduled to run every 15 minutes, every Sunday.
$ export-ldif -D "cn=directory manager" -w password --recurringTask \ "0,15,30,45 * * * 0" -l PATH/export-recurring.ldif -n userRoot Recurring Export task ExportTask-a614e45d-6ba5-4c29-a8e1-d518c20e46ab scheduled successfully
The task scheduling options of a utility enable you to notify an administrator when a task completes or if an error occurs during the task's execution. To use the notification facility, an SMTP server must be configured for the directory server.
The following command configures the SMTP server named mailserver.example.com:
$ dsconfig -D "cn=directory manager" -w password -n set-global-configuration-prop \ --set smtp-server:mailserver.example.com
The following command schedules a backup task and specifies that email@example.com should be notified when the task completes, or when an error occurs:
$ backup -D "cn=directory manager" -w password -a -d /tmp/backups \ --start 20080924121500 --completionNotify firstname.lastname@example.org \ --errorNotify email@example.com Backup task 20080924121500 scheduled to start Sep 24, 2008 12:15:00 PM SAST
Certain tasks might require that another task be completed before the task begins. The task dependency options of a utility enable you to specify that the task depends on another task, and what the task should do should the other task fail.
The following example schedules a backup task that depends on another task, and specifies that the backup should be canceled should the other task fail:
$ backup -D "cn=directory manager" -w password -a -d /tmp/backups \ --start 2008102914530410 --dependency 20080924121500 \ --failedDependencyAction cancel Backup task 2008102914530410 scheduled to start Oct 29, 2008 14:53:04 PM SAST