Hitachi

JP1 Version 12 JP1/Automatic Operation Command and API Reference 


1.6.9 listtasks (outputting the list of tasks and the detailed task information)

Description

The functionality of the listtasks command is as follows:

Outputting the list of tasks or task histories

If you execute the listtasks command by specifying tasks for the output option, you can output the task information displayed in the list of tasks in the Tasks window in a CSV-formatted file. Alternatively, if you execute the command by specifying histories for the output option, you can output the task information displayed in the list of histories in the Tasks window in a CSV-formatted file. Note that debug tasks are not output to either of the CSV files.

In addition, you can specify a period to filter the task information to be output.

Outputting the detailed task information

If you execute the listtasks command by specifying taskdetails for the output option, the detailed task information including input property and output property values is output to the detailed task information storage folder. Note that the detailed information on the debug tasks is not output.

If you execute the submittask command based on the detailed task information# output by the listtasks command, you can re-register the scheduled tasks and recurring tasks with the same setting in a batch.

#

This detailed task information does not include the definition information (service, service template, user, user group, service group, connection destinations, service share properties) and the definition file. Use the backupsystem command to back up those pieces of information.

Figure 1‒1: Output and input of the detailed task information

[Figure]

Syntax

listtasks
     [/startrange {yyyy-mm-dd|,yyyy-mm-dd|yyyy-mm-dd,yyyy-mm-dd}]
     /output {tasks | histories | taskdetails}
      {/file output-file-path |/taskdetaildir detailed-task-information-storage-folder-path}
     [/encoding {UTF-8 | Shift_JIS}]
     /user user-ID
     {/password password | /passwordfile password-file-path}

Arguments

/startrange {yyyy-mm-dd|,yyyy-mm-dd|yyyy-mm-dd,yyyy-mm-dd}

This option specifies the start date or scheduled start date of tasks to filter the tasks to be output.

yyyy must have a four-digit year in half-width numeric characters. mm must have a month from 1 (or 01) to 12 in half-width numeric characters. dd must have a day from 1 (or 01) to 31 in half-width numeric characters.

  • yyyy-mm-dd

    This option causes the command to output the tasks that started or are scheduled to start on and after the specified date.

  • ,yyyy-mm-dd

    This option causes the command to output the tasks that started or are scheduled to start on and before the specified date.

  • yyyy-mm-dd,yyyy-mm-dd

    This option causes the command to output the tasks that started or are scheduled to start within the specified period. The date on the right side of , can accept any date on and after the date specified on the left side.

For recurring tasks, tasks scheduled to start up to the next time are output, and any tasks scheduled to start subsequently are not output.

If you want to output waiting tasks, specify a scheduled date and time instead of a start data and time if the tasks are recurring and scheduled tasks. If they are immediate tasks, specify a submitted data and time. You can check the submitted date and time in the Task Details window.

If this option is omitted, all the tasks viewable to users are output.

Note that an error occurs if you specify the startrange option when taskdetails is specified for the output option.

/output {tasks | histories | taskdetails}

This option specifies which one of the following information is output in the list:

  • tasks

    Outputs the list of tasks from the Tasks window.

  • histories

    Outputs the list of histories from the Tasks window.

  • taskdetails

    Outputs the detailed task information including the input property and output property values.

{/file output-file-path |/taskdetaildir detailed-task-information-storage-folder-path}
  • /file output-file-path

    This option specifies the absolute or relative path to the file in which the list is output. An error occurs if the specified file exists.

    This option is required if tasks or histories is specified for the output option. An error occurs if this option is specified when taskdetails is specified for the output option.

  • /taskdetaildir detailed-task-information-storage-folder-path

    This option specifies the absolute or relative path to an empty folder to which the detailed task information is output. Note that only a folder on the local disk can be specified. The number of characters that can be specified is no more than 180 characters for the absolute path. If the relative path is used, the path being converted to the absolute path must be no more than 180 characters.

    An error occurs if the specified folder does not exist, or the specified folder already contains a file or folder.

    This option is required if taskdetails is specified for the output option. An error occurs if this option is specified when tasks or histories is specified for the output option.

/encoding {UTF-8 | Shift_JIS}

This option specifies the encoding of the output file. If this option is omitted, the default encoding of the OS is used.

If taskdetails is specified for the output option, the encoding specified here is applied only to the task list file (listtasks.csv) located directly under the detailed task information storage folder. The detailed task information, property file (input property file), and output property file are always output in UTF-8.

/user user-ID

This option specifies the user ID for JP1/AO.

The number of possible characters is in the range from 1 to 256 characters.

The possible characters are half-width alphanumeric characters, !, #, $, %, &, ', (, ), *, +, -, ., =, @, \, ^, _, and |.

This option is not case sensitive.

/password password

This option specifies the password of the user indicated by the user option.

You must specify either this option or the passwordfile option. If both options are specified, or if neither are specified, then you will get an error.

The number of possible characters is in the range from 1 to 256 characters.

The possible characters are the same as those for the user option.

/passwordfile password-file-path

This option specifies the absolute or relative path to the password file for the user specified in the user option. You can create a password file by using the encryptpassword command.

You must specify either this option or the password option. If both options are specified, or if neither are specified, then you will get an error.

Output format

The format of output from the listtasks command is as follows:

When outputting the list of tasks and histories (when tasks or histories is specified for the output option)

The output items are output in a single line per task in CSV format.

The values for each output item are enclosed in double quotation marks ("). Any double quotation mark (") contained in the value is escaped with another one added in front of the mark.

Table 1‒8: Output items in the list of tasks

Output item

Content

Task Name

Task name

To Do

To Do setting state

Status

Status of the task

Scheduled Time

Scheduled start date and time

Start Time

Start date and time

Completion Time

End date and time

Schedule Type

Task type

Task ID

Task ID

Description

Task description

Service

Service name

Service Group

Service group

Tags

Tags set for the service

Submitted By

User who executed the task

Submit Time

Submitted date and time

Schedule Interval

Recurrence pattern

Recurrence Time

Recurrence time

Schedule Start Date

Start date of recurrence

Notes

Memo

Step Start Time

Step start date and time

Supported Action Type

Operations that can be performed for the task

Service status

Service status

#

The configuration type is output only if the Admin or Develop role has been set for the target resource groups from the user group that the user belongs to.

The following list shows some examples of file outputs.

"Task Name","To Do","Status","Scheduled Time","Start Time","Completion Time","Schedule Type",
"Task ID","Description","Service","Service Group","Tags","Submitted By","Submit Time","Schedule Interval",
"Recurrence Time","Schedule Start Date","Notes","Step Start Time","Supported Action Type","Service Status"
"Remote command execution_20150828130932","FALSE","Failed","","2015/8/28 13:09","2015/8/28 13:09","immediate","4015",
"","Remote command execution","DefaultServiceGroup","Basic,OS_Operations","System","2015/8/28 13:09","","","","","","forciblyStop,retry","Release"

When outputting the detailed task information (when taskdetails is specified for the output option)

The following shows the data that is output to the detailed task information storage folder.

Figure 1‒2: Structure of the detailed task information storage folder

[Figure]

The following lists the contents of the detailed task information storage folder:

Located in

In Windows:

JP1/AO-installation-folder\bin

In Linux:

/opt/jp1ao/bin

Execute permission

Execute the command as a user with Administrator or root permissions for the OS. If a user without Administrator or root permissions executes the command, a message appears asking the user to elevate the permission level.

Permission required for the user specified for the user option depends on the argument specified for the output option.

When tasks or histories is specified for the output option (when outputting the list of tasks or histories)

The Admin, Develop, Modify, or Submit role must be set for the target service group from the user group that the user specified for the user option belongs to. The command does not output a list of tasks for any service groups for which none of these roles are set.

When taskdetails is specified for the output option (when outputting the detailed task information)

Specify the user who has the Admin role for the user option. The Admin role which allows access to the entire resource is required because the information on the entire tasks registered in JP1/AO are output, and the information is output without processing even if the input property or output property values include information such as the host name, IP address, user name, and password. Store the output detailed task information in a properly access-controlled location.

Return code

The following table lists the return codes from the command.

Return code

Description

0

The command succeeded.

1

The argument is invalid.

2

The command execution has been interrupted.

3

The service status is invalid.

4

One of the other commands is running.

5

Communication failed.

6

Authentication failed.

7

An invalid path is specified.

8

The file with the same name already exists in the output path.

9

The specified path does not exist.

10

The specified path is not accessible.

11

The specified folder is not empty.

12

An invalid encoding is specified.

13

Outputting the file failed.

14

You do not have permission to execute the command.

150

Obtaining the list of tasks failed.

151

Obtaining the list of histories failed.

152

Obtaining the detailed task information failed.

255

The command execution has been interrupted due to an error other than the above.

Example

The following examples show how to use the command for each case.