Sun Java System Messaging Server 6.3 Administration Guide

4.6 To Schedule Automatic Tasks

Messaging Server provides a general task scheduling mechanism using a process called imsched. It is intended for scheduling Messaging Server processes. It is enabled by setting the local.schedule.taskname configutil parameter. If you modify the schedule, you must either restart the scheduler with the command stop-msg sched and start-msg sched, or you can refresh the scheduler process (refresh sched).

This parameter requires a command and a schedule on which to execute the command. The format is as follows:

configutil -o local.schedule.taskname -v “schedule

taskname is a unique name for this command/schedule combination.

schedule has the format:

minute hour day-of-month month-of-year day-of-week command args

command args can be any Messaging Server command and its arguments. Paths can be relative to msg-svr-base or absolute paths. See 4.6.2 Pre-defined Automatic Tasks for relative path examples.

minute hour day-of-month month-of-year day-of-week is the schedule for running the command. It follows the UNIX crontab format.

The values are separated by a space or tab and can be 0-59, 0-23, 1-31, 1-12 or 0-6 (with 0=Sunday) respectively. Each time field can be either an asterisk (meaning all legal values), a list of comma-separated values, or a range of two values separated by a hyphen. Note that days can be specified by both day of the month and day of the week and both will be required if specified. For example, setting the 17th day of the month and Tuesday will only run the command on the 17th day of a month when it is Tuesday. See Table 20–10

Note that if you modify scheduler, you must either restart the scheduler with the command stop-msg sched and start-msg sched, or you can refresh the scheduler process:

refresh sched

To disable a scheduled task, run the following:


# configutil -o local.schedule.taskname.enable -v no 
#  refresh sched

4.6.1 Scheduler Examples

Run imexpire at 12:30am, 8:30am, and 4:30pm:


# configutil -o local.schedule.rm_messages -v “30 0,8,16 * * * /opt/SUNWmsgsr/sbin/imexpire” 

Display MTA channel queue message counters every 20 minutes:


# configutil -o local.schedule.counters -v “0,20,40 * * * * /opt/SUNWmsgsr/sbin/ims
# imta qm counters > /tmp/temp.txt” 

Run imsbackup Monday through Friday at midnight (12AM):


# configutil -o local.schedule.msbackup -v “0 0 * * 1-5 /opt/SUNWmsgsr/sbin/imsbackup -f \
backupfile /primary”

4.6.2 Pre-defined Automatic Tasks

At installation, Messaging Server creates, schedules and enables a set of pre-defined automatic tasks. These are shown below.

The following automatic tasks are set and enabled for the message store:


local.schedule.expire = "0 23 * * * sbin/imexpire"
local.schedule.expire.enable = 1
local.schedule.snapshotverify = "0 0,4,8,12,16,20 * * * sbin/imdbverify -m"
local.schedule.snapshotverify.enable = 1

The following automatic tasks are set and enabled for the MTA:


local.schedule.purge="0 0,4,8,12,16,20 * * * sbin/imsimta purge -num=5"
local.schedule.purge.enable = 1
local.schedule.return_job = "30 0 * * * lib/return_job"
local.schedule.return_job.enable = 1

The following automatic tasks are set and enabled for the message store:


local.schedule.msprobe = "5,15,25,35,45,55 * * * * lib/msprobe"
local.schedule.msprobe.enable = 1