Top
Systemwalker Runbook Automation Reference Guide
Systemwalker

3.4.21 Search string in file

Description

This operation component searches character strings in text files.

Options

Basic Options

(1) hostname

Host name or IP address of the file where the string is to be searched resides.

To serrch the character string to the file that exists on the Management Server, specify the following:

  • For IPv4: 'localhost' or '127.0.0.1'

  • For IPv6: 'localhost' or '::1'

An argument error occurs if the host name or IP address is omitted.

The maximum length of the host name or IP address is 1,024 characters. An argument error occurs if this is exceeded.

(2) searchfile

The name (full path) of the file where the string is to be searched.

An argument error occurs if the file name is omitted.

The maximum length of the file name is 1,024 characters. An argument error occurs if this is exceeded.

(3) searchstring

Specify the string that is to be searched.

An argument error occurs if the character string is omitted.

The maximum length of the searching character string is 1,024 characters. An argument error occurs if this is exceeded.

Advanced Options

(1) outputmode

The format for outputting the results of the string search.

Specify LineNumber (the line number is output), Text (the content of the line is output), or ALL (the line number and the content of the line are output).

An argument error occurs if the output form other than the above is specified.

If the output form is omitted, only the content of the line is output.

For example:

Content of text

2010/01/01 00:00:00 rba:message1

2010/01/01 00:00:00 rba:message2

2010/01/01 00:00:00 other:message1

2010/01/01 00:00:00 rba:message3

Search character string:rba

Output example if "line" is specified.

1

2

4

Output example if "text" is specified.

2010/01/01 00:00:00 rba:message1

2010/01/01 00:00:00 rba:message2

2010/01/01 00:00:00 rba:message3

Output example if "all" is specified.

1, 2010/01/01 00:00:00 rba:message1

2, 2010/01/01 00:00:00 rba:message2

4, 2010/01/01 00:00:00 rba:message3

(2) searchscope

The search range of the string within the file.

Specify search ranges using line numbers.

Separate the start position and the end position numbers with a hyphen (-).

If the starting position is omitted, the starting position becomes the first of the file.

If the end position is omitted, the end position becomes the end of the file.

If the starting position and the end position are omitted, search in the whole files.

For example:

If search the 20th line from the 10th line: 10-20

If search the 20th line from the head of the file: -20

If search from the 10th line to the end of the file: 10-

If the file does not have the specified line number, then its specification will be ignored.

An argument error occurs if the same line number is specified more than once.

(3) searchmode

The search method for the string.

Specify First (search until the first occurrence of the string) or ALL (search the entire range). This option is not case sensitive.

An argument error occurs if the output form other than the above is specified.

If the search method is omitted, all ranges of specification are searched.

(4) exclusionsearch

Specify whether to use exclusive search.

Specify off (normal search) or on (exclusive search). This option is not case sensitive.

An argument error occurs if the output form other than the above is specified.

If the specification is omitted, specify 'off' by default.

(5) outputfile

Name (full path) of the file that will output the result of the search for the string.

If the file name is omitted, search results are output to the search_result by default.

Specify the file setting the writing authority, if the existing file is specified for outputfile option. The action is not guaranteed if the file that is not setting the writing authority is specified.

An argument error occurs if specify the same file name as searchfile.

The maximum length of the file name is 1,024 characters. An argument error occurs if this is exceeded.

(6) overwrite

If the file name being output already exists, specify "on" or "off" for overwrite. This option is not case sensitive.

If "on" is specified, it overwrites when the file already exists.

If "off" is specified, the error is returned when the file already exists.

If the specification is omitted, specify 'off'.

(7) ostype

OS type of the host existing the file to search the character string.

Specify Windows, Linux or Solaris. This option is not case sensitive.

If the OS type is omitted, the Configuration Management Database (CMDB) will be searched based on the specified host name or IP address, and Systemwalker Runbook Automation automatically sets the acquired OS type as the value.

The maximum length of the OS type is 1,024 characters. An argument error occurs if this is exceeded.

(8) username

Name of the user connecting with SSH to the host existing the file to search the character string.

If the connected user name and password required for connection are not specified, the Configuration Management Database (CMDB) is searched based on the specified host name or IP address and Systemwalker Runbook Automation automatically sets the acquired connected user name as the value.

If the operation component connects with the file transfer infrastructure, the connected user name will be fixed at either of the following names and cannot be changed. In this case, the user name is ignored even if specified.

  • If the Business Server is running on Windows: SYSTEM user

  • If the Business Server is running on Linux or Solaris: root

The maximum length of the connected user name is 1,024 characters. Argument error occurs if this is exceeded.

(9) password

Password of the user connecting with SSH to the host existing the file to search the character string.

If the connected user name and password required for connection are not specified, the Configuration Management Database (CMDB) is searched based on the specified host name or IP address and Systemwalker Runbook Automation automatically sets the acquired connected user name as the value.

If it connects with file transfer infrastructure, the connected user password is invalid.

The maximum length of the connected user password is 1,024 characters. Argument error occurs if this is exceeded.

(10) execusername

Name of the user searching the character string on the host where the file to which the character string is searched exists.

If the "execusername" and "execpassword" are not specified, the Configuration Management Database (CMDB) is searched based on the specified host name or IP address and Systemwalker Runbook Automation automatically sets the acquired administrator user as the value.

If not to register to CMDB, it is executed by name of the user connecting.

If the host specified in "hostname" is running on Windows and if it connects with the file transfer infrastructure, execute the command as a SYSTEM user. In this case, the connected user name is invalid.

The maximum length of the user name is 1,024 characters. An argument error occurs if this is exceeded.

(11) execpassword

This operation component does not use the value of "execpassword". The value of "execpassword" is ignored even if specified.

(12) timeout

This is the completion timeout (seconds) for the execution of operation components.

Values between 300 and 86400 (1 day) can be specified.

For example: When timeout is to occur every 10 minutes: 600

When the execution of the operation components is not completed even if the specified time passes, the processing of the operation components is interrupted in return value 201.

(13) retry

This is the retry count for the execution of operation components.

When the operation components end in return value 161, the retry count is specified. Values between 0 and 5 can be specified.

As a result of retrying, if the operation components ended by the return values other than 161, the execution of the operation components ends even if it doesn't reach the specified retry count. The return values of the operation components become the value executed at the end.

For example: When retries are to be performed twice: 2

(14) retry_interval

This is the retry interval (seconds) for operation components.

When the operation components end in return value 161, the retry interval is specified. Values between 1 and 14400 can be specified.

For example: When retrying in 300 seconds: 300


If the specification of the timeout, retry, and retry_interval is omitted and a value beyond the limits of the above-mentioned is input, the value specified with the operation components definition file becomes effective. Refer to "2.5 Definition File for Operation Components" for details.

Return Values

Icon

Name

Return value

Description

Detected

0

Searching the character string in the file was successful. The character string was found.

Undetected

1

Searching the character string in the file was successful. The character string was not found.

Failure

161

Failed to search the character string in the file. Retried if a retry count has been specified.

177

Failed to access the file.

187

Authentication failed when an attempt was made to connect to the Business Server over the network (using SSH).

Alternatively, an error occurred during the processing of communications with the Business Server (file transfer infrastructure). In this case, the error code for the file transfer infrastructure is output to the execution results. Refer to "3.21 Detailed Code of File Transfer Infrastructure" for information on error codes.

188

When an operation component was performing an operation on a Business Server where an RBA Agent has not been installed, the network communications (SSH) with the Business Server was closed.

189

An attempt to connect to the Business Server over the network (using SSH) failed.

Alternatively, an error occurred during the processing of communications with the Business Server (file transfer infrastructure). In this case, the error code for the file transfer infrastructure is output to the execution results. Refer to "3.21 Detailed Code of File Transfer Infrastructure" for information on error codes.

197

There is an error in the input information.

198

There is an error in the option content.

200

Search to the character string in the file terminated abnormally.

-

-

201

Execution of operation component timed out.

202

The operation component was not executed. There is a problem in the setting to execute operation components.

203

Failed to execute the operation component. There is a problem in the Operation Automation Server environment.

205

The operation component was not executed. There is a problem with the input information specification of the operation component.

206

The operation component was not executed normally. There is a problem with the output information specification of the operation component.

207

The operation components were not executed. There is a possibility that the operation components are not registered in the Management Server.

208

The Automated Operation Process has been canceled because the Automated Operation Process was recovered while the operation component was executing.

Output information

Variable

Description

message

This variable will be set to the following message if a string in the file is searched successfully.

The operation component was successful.

If searching a string in the file fails, the content of the error will be output as a string.

search_result

This variable is set to the result of searching for a string in the file.

returnCode

This variable is set to the return value.

Notes