Oracle Blog

Launching SES schedules from the command line

The scheduler within the SES admin system has some limitations. For
example you can't ask a schedule to run every weekday but not at
weekends.

For this reason some users prefer to use a scheduler such as "cron"
instead.

There is a utility called "searchadminctl" which can be used to launch
schedules, but this will not "queue" schedules - if the schedule is
already running then searchadminctl will just exit.

The shell script below checks the status of the schedule, and if it is
in "launching" or "executing" status it will wait until it completes
before restarting it.NB to check the schedule, it looks in an internal table. It is
possible, though unlikely, that this table name or layout could change
in a future version.
#!/bin/bash

# Shell script to launch a schedule. If the schedule is already running,
# wait for it to complete.

# Note: if you get an error "./launch.sh: line 29: [: too many
arguments"
# it probably means you have the schedule name wrong

# SET THESE NEXT FOUR VARIABLES TO SUIT YOUR ENVIRONMENT

# File to set up environment variables ORACLE_HOME, ORACLE_SID and PATH
export ENV_FILE=/home/raford/ses.env

# SES Admin Password
export SES_PWD=sespassword

# Name of Schedule to launch
export SCHEDULE_NAME="My Schedule Name"

# Delay time to wait between tests if schedule is running (seconds)
export WAIT_TIME=60