Database Reference
In-Depth Information
Chapter 8
Sample EM CLI Scripts
Throughout this topic we've shown you how to use EM CLI to manage your OEM environment, including using the
command line,. I scripting option, which uses JSON and Jython.
This chapter contains some sample scripts for you to adapt to your environment.
Section 1: Function Library and Shell Scripts
Section 2: EM CLI and Veritas Cluster Services
Section 3: Essential OMS Server-Management Scripts
Section 4: EM CLI Scripting and Interactive Scripts
Section 1: Function Library and Shell Scripts
Chapter 5 explored various ways you could apply EM CLI with shell scripts. This section expands on those solutions
and provides you with sample scripts you can use in your environment.
The samples in this chapter have been edited for clarity, mostly by removing formatting options for echo
statements and redirections to log files. Two of the most important things you must provide in your scripts are clear
instructions for attended online use and complete log files for unattended execution through Cron or another job
scheduler like OEM.
Command-Line Inputs
The use of validated input values provides scalability and ease of use. Before you deploy your scripts, consider adding
and testing this important capability.
Nearly all of the scripts in this section require one or more input variables at the command line, often simply
the target name. Variables passed at the command line are represented in the body of the script in the order they
appear on the command line. The executable file is represented as $0, the first string after that is $1, and so forth. For
example, you could have an entry like this:
./oem_target_blackout.sh orcla
This example translates variable $0 as the script name for oem_target_blackout.sh and $1 for the database
name. The logic within the scripts should verify that required command-line inputs are not null or that they exit with
a clear error statement telling the user or the log file what went wrong. You'll see several examples of this technique in
the sample scripts.
 
Search WWH ::




Custom Search