Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Automatic Operation Service Template Developer's Guide


4.3.10 Specifying commands in the Command line text box

The information you can enter in the Command line text box depends on the option specified for Execution Mode and whether you choose to specify the value of an input property as an argument of the command you are executing.

Note that special characters specified in the Command line text box, such as those used to indicate environment variables, will not be escaped. However, depending on the platform, the following characters are automatically escaped when the values of mapped input properties are passed to the command line:

When mapping an input property as a command line argument, enclose the value of the argument in double quotation marks (for example, "?dna_property-key-of-plug-in-property?"). When executing a PowerShell script, you can enclose the value in double or single quotation marks.

If Platform is Windows and the value of an input property contains a double-quotation mark, an error will occur when the plug-in is executed.

When Script is specified for Execution Mode:

Create the script to be executed on the target device, and enter the command that calls the script in the Command-line text box. If the script is a single file, specify the file name. If the script is a zip archive containing multiple files, specify a relative path whose current directory is the location where the archive will be extracted.

The script is copied to a temporary folder under the folder specified in Execution Directory.

If Platform is AIX, HP-UX, Linux, or Solaris, the command line is automatically prefixed with ./ when the command is executed. You do not need to manually add the prefix. If you specify ./ in the command line, the script file appears after ././ but still works normally. Special characters, such as those used to indicate environment variables in the command line, are not escaped.

The following shows how to enter information in the Command line text box when the Script option is specified for Execution Mode.

Example of specifying information in the Command line text box

cmd.exe /q /c "AAA.bat bbb ccc"

Example of script file (AAA.bat) contents

[Figure]

If the value in Platform is Windows, the command is converted to a batch file and executed on the operation target device. For this reason, the results of the command might differ from those of the same command executed at the command prompt.

When Command is specified for Execution Mode:

Enter the command to be executed on the operation target device directly in the Command line text box. You do not need to create a script.

The following shows how to enter information in the Command line text box when the Command option is specified for Execution Mode

Example of specifying information in the Command line text box

zzz.exe aaa bbb

When specifying input property values as command arguments

To specify the value of an input property in an argument of a command, specify ?dna_property-key-of-plugin-property? in the Command line text box.

Example of specifying information in the Command line text box

scriptA.sh -xx ?dna_input01? -yy ?dna_input02?

In this example, ?dna_input01? is replaced with the value of the plug-in property input01, and ?dna_input02? is replaced with the value of the plug-in property input02.

When specifying a non-standard script

JP1/AO executes scripts using cmd.exe when the operation target device is running Windows, and the user's login shell when the device is running UNIX. If you want to run a non-standard script, you need to define the instructions required to run the executable file that implements the script.

The following shows an example of running a PowerShell script from the command prompt and establishing a connection with vCenter.

Example of specifying information in the Command line text box
powershell -executionPolicy RemoteSigned -command ".\vsphereConnectChallenge.ps1 '?dna_vCenterServerName?' '?dna_userName?' '?dna_password?' '?dna_portNumber?' '?dna_protocol?'; exit $LASTEXITCODE" 2>&1
  • PowerShell cannot execute scripts by default. By specifying powershell -executionPolicy RemoteSigned in the command line, you can execute a local PowerShell script on an operation target device of JP1/AO.

  • Here, ?dna_property-key? is a variable replaced with the value of a property. Enclose ?dna_property-key? with double or single-quotation marks.#

    This allows the properties specified in the Command line text box to be passed to the shell even if the property has a null value.

    #

    If you enclose a property with double-quotation marks (") in PowerShell and that property has a null value, PowerShell skips the property. If you enclose it in single-quotation marks ('), the property is interpreted as a null value and not skipped. By avoiding double-quotation marks ("), you can ensure that the script is executed as originally defined in terms of the order and content of arguments.

Related topics