-input_file Syntax Guidelines

Input files allow you to provide a series of arguments specific to a verb or job in a file format, allowing for reusability and control.

-input_file Syntax

This option enables you to provide an argument to be specified in a file. For example:

emcli xyzverb -input_file="arg1:file1.txt" -input_file="arg2:file2.txt" 

This string literally translates to:

emcli xyzverb -arg1=<contents of file1.txt> -arg2=<contents of file2.txt>
emcli xyzverb -input_file="name:/tmp/b1.txt"  -input_file="type:/tmp/b2.txt" 
-input_file="bcnName:/tmp/b3.txt" 

This example makes User1 an Enterprise Manager user, which is already created on an external user store like the SSO server. The contents of priv_file are view_target;host1.example.com:host. User1 will have view privileges on the host1.example.com:host target.

emcli create_user
      -name="User1"
      -type="EXTERNAL_USER"
      -input_file="privilege:/home/user1/priv_file"

-input_file for Jobs

For most job verbs, you can specify all of the needed properties in a property file. You can also provide a few properties on the command line. Properties set on the command line override values set in the file.

The property file consists of name=value pairs. For example, put the following into myFile.txt:

name=MY JOB 1
    type=OSCommand
    description=this is a test job
    target_list=target1:host
    variable.default_shell_command=ls -l
    schedule.frequency=IMMEDIATE

... then run:

emcli create_job -input_file=property_file:myFile.txt

This creates an OS Command job called "MY JOB 1" using preferred credentials.

Usage of Properties

For the create verbs, all properties set in the file are used. For verbs that act on multiple jobs, like suspend and resume, only "search" properties are used (name, type, targets. and scheduled starting and ending times).

Creating a Property File

The best way to create a property file is to start by describing a job similar to the one you want to create, and/or by describing a job type. This provides a list of which properties are needed by a given job type.

Determining Variables for a Job

Most properties are the same from one job to another. For example:

name, type, description, kind, targetType, cred, schedule notification

The variables needed for a job type change from job to job. Describe a job type to find out which variables it requires.

For example, the following command creates a property file template based on job MYJOB1. This lists the properties set by this job.

emcli describe_job [-verbose] -name=MyJob1 > myPropFile.txt

This example creates a property file template for an OS Command job. This lists the properties allowed by this job type, including all required and optional variables. Variables marked as deprecated should be avoided.

emcli describe_job_type [-verbose] -type=OSCommand > myPropFile.txt