Top
Systemwalker Software Configuration Manager Developer's Guide
FUJITSU Software

2.1.4 Parameter Settings Scripts

A parameter settings script is a script used to configure parameters in software. This script is forwarded to the server and runs on it.

A parameter settings script is composed of multiple files. Note that the names of Windows batch files and Linux shell scripts are fixed. These files are described below.

Startup script format (batch files) [Windows]

Create the startup script for batch files (startup.cmd) using the format below.

The environment variable settings script (setenv.cmd) is called first. Specify a process that acquires parameter values from the environment variables and sets the parameters in the software. Parameter values can also be acquired from the parameter information XML file. The script returns 0 if successful, or another value otherwise. The standard output and standard error output are directed to the agent log.

@echo off
setlocal
@rem Configure environment variables
call .\setenv.cmd
@rem Software setup process
<Processing for each software product>
setup -host %manager_name%
@rem Return results (normal)
if ERRORLEVEL 1 goto ERROR_END
endlocal
exit /B 0
@rem Return results (error)
: ERROR_END
echo ERROR0001 Parameter settings failed. 1>&2
endlocal
exit /B 1

Startup script format (shell scripts) [Linux]

Create the startup script for shell scripts (startup.sh) using the format below.

The environment variable settings script (setenv.sh) is called first. Specify a process that acquires parameter values from the environment variables and sets the parameters in the software. Parameter values can also be acquired from the parameter information XML file. The script returns 0 if successful, or another value otherwise. The standard output and standard error output are directed to the agent log.

#!/bin/sh
# Configure environment variables
source ./setenv.sh
# Software setup process
<Processing for each software product>
setup -host ${manager_name}
# Return results
if [ $? = "0" ]; then
 # Returns normal
 exit 0
else
 # Returns an error
 echo "ERROR0001 Parameter settings failed." 1>&2
 exit 1
fi

Environment variable settings script format (batch files) [Windows]

This product generates the environment variable settings script batch file (setenv.cmd) in the format below.

The environment variable names are determined by the parameter keys in the parameter settings definition (parameter information). The environment variable values are determined by the parameter values in the parameter settings definition or in the parameter information. However, the following conversions are performed:

set <parm key1>=<parm val>
set <parm key array>=<num of elements>     ...string array type
set <parm key array>_<index> =<parm val>  ...string array type
set <parm key map>=<num of entries>        ...map type
set <parm key map>_<subkey>=<parm val>    ...map type
<Define as many environment variables as there are parameters>

Example:

set manager_name=server1
set manager_adata=2                  ...string array type
set manager_adata_1=data1           ...string array type
set manager_adata_2=data2           ...string array type
set manager_bdata=0                  ...string array type with 0 elements
set manager_cdata=3                  ...map type
set manager_cdata_subkey1=data1    ...map type
set manager_cdata_subkey2=data2    ...map type
set manager_cdata_subkey3=data3    ...map type
set manager_ddata=0                  ...map type with 0 entries

Environment variable script format (shell scripts) [Linux]

This product generates the environment variable settings script shell script (setenv.sh) in the format below.

The environment variable names are determined by the parameter keys in the parameter settings definition (parameter information). The environment variable values are determined by the parameter values in the parameter settings definition or in the parameter information. However, the following conversions are performed:

<parm key>=<parm val>
<parm key>=<num of elements>    ...string array type
<parm key>_<index>=<parm val>   ...string array type
<parm key>=<num of entries>     ...map type
<parm key>_<subkey>=<parm val>  ...map type
<Define as many environmental variables as there are parameters>

Example:

manager_name=server1
manager_adata=2                  ...string array type
manager_adata_1=data1           ...string array type
manager_adata_2=data2           ...string array type
manager_bdata=0                  ...string array type with 0 elements
manager_cdata=3                  ...string array type
manager_cdata_subkey1=data1    ...map type
manager_cdata_subkey2=data2    ...map type
manager_cdata_subkey3=data3    ...map type
manager_ddata=0                  ...map type with 0 entries

Parameter information XML file format

The parameter information XML file for configured parameters is generated by this product. Reference the content of the key tags and their values <parameters> section of this file. Other tags are omitted or are not required for referencing.

An example of a generated parameter information XML file is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<parameterInfo version="3.0">
	<name>parmInfoName</name>
	<parameters>
		<parameter>
			<key>parmKey</key>
			<value>parmVal</value>
		</parameter>
		...
	</parameters>
</parameterInfo>

An example of a parameter information XML file is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<parameterInfo version="3.0">
	<name>Parameter Info</name>
	<parameters>
		<parameter>
			<key>manager.name</key>
			<value>server1</value>
		</parameter>
		<parameter>
			<key>manager.adata</key>
			<array>
				<element>data1</element> 
				<element>data2</element> 
			</array>
		</parameter>
		<parameter>
			<key>manager.cdata</key>
			<map>
				<entry>
					<subkey>subkey1</subkey>
					<value>data1</value> 
				</entry>
				<entry>
					<subkey>subkey2</subkey>
					<value>data2</value> 
				</entry>
				<entry>
					<subkey>subkey3</subkey>
					<value>data3</value> 
				</entry>
			</map>
		</parameter>
	</parameters>
</parameterInfo>

Note

  • Commands that cannot be used with a script

    Do not execute the following commands from a script, because this will cause the script to enter standby status on the business server, and its processing will not complete:

    • Commands that require interaction [Windows/Linux]

    • Commands for which a window opens during execution [Windows]

    • AT commands [Windows]

    • Shell scripts created using PowerShell [Windows]

    • Commands running in full-screen mode [Linux]

  • Parameter settings scripts

    • Order of execution

      The parameter settings script is operated according to the order specified in the Parameter Settings Wizard.

  • Startup script

    • Execution privileges

      Must be executed by an Administrator in Windows.

      Must be executed by a superuser in Linux.

    • Current directory

      The current directory is the path in which the startup script files are stored.

    • Execution privileges [Linux]

      Configured automatically during execution.

    • Line feed

      In Windows, use CR+LF.

      In Linux, use LF.

    • Byte order mark (BOM) [Linux]

      Do not include the UTF-8 byte order mark (BOM) in shell scripts.

  • Environment variable settings script

    • Environment variable definitions

      Environment variables cannot be defined if parameter values are not configured. Accordingly, whether parameter values will be configured in the startup script is determined by whether environment variables have been defined.

      The method for determining whether environment variables have been defined is shown below:

      Batch files: [Windows]

      if defined <environment variable> (<defined process>) else <undefined process>

      Example:

      set PARAM=%hostname%	
      if defined parameter_Key1 (set PARAM=-v %parameter_Key1% %PARAM%)

      Shell scripts: [Linux]

      ${<environment variable>+${<environment variable>}}

      Example:

      PARAM=${hostname}
      PARAM="${parameter_Key1+"-v ${parameter_Key1}"} ${PARAM}"
    • Empty strings in values [Windows]

      An empty string cannot be configured in environment variables in Windows. For this reason, specify empty strings in batch files using "__EMPTY__" (prefixed and suffixed by 2 underscores). Note that as a result, the string "__EMPTY__" cannot be used as a parameter value.

    • Symbols (special characters)

      Some parameter values passed by an environment variable settings script do not accept symbols (special characters), or an escape character must be specified before a symbol (special character).

  • File attachments

    • Execution privileges [Linux]

      If a file attachment includes a shell script, configure execution privileges within the startup script of the shell script.