submittask command

Ops Center Automator User Guide

Version
10.8.x
File Size
3.6 MB
Audience
anonymous
Part Number
MK-99AUT001-14

The submittask command submits a service for execution using the specified service name, service group name, and property options, and returns the task ID as the execution output of the command.

Functions

The submittask command has four functions:

  • Immediate execution of a service.
  • Scheduled execution of a service.
  • Recurrent execution of a service.
  • Reregistration of tasks.

    If this option is specified, you can reregister tasks that were output by the listtasks command with the taskdetails option.

Syntax: Immediate execution of a service

submittask {/servicename ServiceName [/servicegroup ServiceGroup]
	[/taskname  TaskName]
	[/taskdescription TaskDescription]
	[{[/property Key "Value"]... | /propertyfile PropertyFile}]
	[/user UserName | /user UserName /passwordfile PasswordFile]
	[/wait]
	[/authmode local | external] | /help}

Syntax: Scheduled execution of a service

submittask {/servicename ServiceName
	[/servicegroup ServiceGroup]
	[/taskname TaskName]
	[/taskdescription TaskDescription]
	[{[/property Key "Value"]... | /propertyfile PropertyFile}]
	[/user UserName | /user UserName /passwordfile PasswordFile]
	/scheduledate yyyy-mm-dd
	/scheduletime hh:mm 
	[/authmode local | external] | /help}

Syntax: Recurrent execution of a service

submittask {/servicename ServiceName
	[/servicegroup ServiceGroup]
	[/taskname TaskName]
	[/taskdescription TaskDescription]
	[{[/property Key "Value"]... | /propertyfile PropertyFile}]
	[/user UserName | /user UserName /passwordfile PasswordFile]
	/recurrencepattern {daily[:{1h|2h|3h|4h|6h|8h|12h|24h}] |
	weekly:sun,mon,...,sat | monthly:{dd,dd,...,dd
	[,endofmonth] | endofmonth}}
	/recurrencetime hh:mm /recurrencestart yyyy-mm-dd
	[/authmode local | external] | /help}

Syntax: Reregistration of tasks

submittask {/reregister
	/taskdetaildir DirectoryName
	[/setoriginalsubmitter]
	[/user UserName | /user UserName /passwordfile PasswordFile]
	[/authmode local | external] | /help}
Note: You are prompted to enter the password in interactive mode if you do not specify the passwordfile option.

Permission

  • To run this command, you must have the Admin, Modify, or Submit role in Ops Center Automator and Administrator permission for the OS.
  • You cannot run services that are in a service group whose role is not set.
  • The service you want to run must belong to the service group with a role that is assigned by the user group. The user must belong to the user group.

Options

Option Description
/servicename

Specify a service name.

The name of a service you want to submit. The service name can be 1 to 128 characters long.

/servicegroup

Specifies a service group to which the service belongs.

The name of the service group that the service belongs to. This is an optional parameter.

If you omit this option, the service group that is associated with the user who is specified in the /user option is used. However, if more than one service group is associated with that user, an error occurs.

The service group name can be 1 to 80 characters long and consists of half-width alphanumeric characters and _ (underscore).

/taskname

Specify a task name.

The name of the task. If you omit this option, the system defaults to service-name_YYYYMMDDhhmmss, where service-name is the value of the /servicename option and YYYYMMDDhhmmss is the time when the service runs.

The task name can be 1 to 128 characters long and can consists of any characters except control characters ('\u0000'~'\u001F' or \u007F'~'\u009F').

This is an optional parameter.

/taskdescription

Specify a task description.

The description of the task. The description can be 1 to 256 characters long and can consists of any characters except control characters ('\u0000'~'\u001F' or \u007F'~'\u009F').

This is an optional parameter.

/property

Specify a property key and value.

One or more property key-value combinations that are used by the service to be performed.

If a property value is not set for a key, the default value used. If the value of a required property key is not set, then an error occurs.

You cannot specify both the /property and the /propertyfile options. If you do, then an error occurs.

You can specify this option more than one time, for example, /property property-key-1 property-value-1 /property property-key-2 property-value-2. The maximum number of combinations of property keys and values available is 1000 pairs. This value can be changed by using the server.editor.publicProperty.perTemplate.maxnum key in the config_user.properties file.

  • key is the property key for the service. It can be 1 to 1024 characters long. The key consists of half-width alphanumeric characters and the following characters: / (slash), . (period), (hyphen), and _ (underscore). Specifying the same property key more than one time causes an error.
  • value is the value for the key property. If the value includes a space or special character, the value must be enclosed in double quotation marks (").
/propertyfile

Specify a properties file. Use an absolute or relative path.

The name of a properties file, including an absolute or relative path, that defines the property settings that the service you want to perform uses.

Property keys and values that are not specified in the properties file are set to default values. If you do not specify a required property key and that key has no default value, then an error occurs.

This option and the /property option cannot be specified at the same time. If both options are specified, then an error occurs.

Additional requirements:

  • Location: The properties file can be in any folder. However, the user who runs the command must be able to access it.
  • File name: Any file name.
  • Key-value combination format:

    property-key=property-value(linefeed code)

    property-key=property-value(linefeed code)

If you add a suffix @FILE to the key, it is possible to specify a text file to value. For example, key@FILE=C:\properties\valuefile.txt.

/user

Specify a user ID.

The ID for the Ops Center Automator user who has access permission to run the service.

The ID can be 1 to 256 half-width alphanumeric characters. It can consist of any characters, except the following: ! # $ % & ( ) * + - . = @ \ ^ _ |. The ID is not case-sensitive.

/passwordfile

Specify a password file. Use an absolute or relative path.

The absolute or relative path to the password file for the user who is specified in the /user option.

You can create a password file by using the encryptpassword command.

/wait

Wait for a task to finish.

Shows the task execution result (normal termination or failure). If the /wait option is not specified, the command ends without waiting for the task to end. In this case, a message reporting the task ID is provided only when the task execution has started normally.

/scheduledate

Specify a date for executing a service.

When this option is specified, any of the following conditions will result in an error:

  • A combination of arguments that is not valid.
  • The form of the specified date is incorrect.
  • The time indicated by / scheduledate and / scheduletime is in the past. The relevant time is server time.
  • The specified date is outside the range of January 1, 1994 to December 31, 2036

Format:

Specify the date in the form of "yyyy-mm-dd." Specify the year as yyyy in four digits. Specify the month as mm in the range 1 (or 01) to 12. Specify a day as dd in the range 1 (or 01) to 31.

/scheduletime

Specify a time for executing a service.

When this option is specified, any of the following conditions will result in an error:

  • A combination of arguments that is not valid.
  • The form of the specified time is incorrect.
  • The time indicated by / scheduledate and / scheduletime is in the past. The relevant time is server time.

Specify the time in the form of "hh:mm." Specify hours as hh in the range 0 (or 00)-23. Specify minutes as mm in the range 0 (or 00)-59.

/recurrencepattern

Specify a pattern for a recurring service.

Use this option with the /recurrencetime option, and the /recurrencestart option.

When this option is specified, the following conditions will result in an error:

  • A combination of arguments that is not valid.
  • The format of the specified fixed execution cycle is incorrect.

Recurrence options and formats:

  • Daily: specify "daily:1h, 2h, 3h, 4h, 6h, 8h, 12h, 24h". The default recurrence is every 24 hours.
  • Weekly: specify "weekly:sun, mon, ..." using three letter English abbreviations for days of the week and comma-separated values following a colon. The days can be in any order.
    • Sunday: sun
    • Monday: mon
    • Tuesday: tue
    • Wednesday: wed
    • Thursday: thu
    • Friday: fri
    • Saturday: sat
  • Monthly: specify two-digit comma-separated values following a colon. For the last day of the month, specify "endofmonth."
/recurrencetime

Specify the execution time for a recurring service.

Use this option with the /recurrencepattern option, and the /recurrencestart option.

When this option is specified, the following conditions will result in an error:

  • A combination of arguments that is not valid.
  • The form of the specified time is inaccurate.

Format:

Specify the time in the form of "hh:mm." Specify hours as hh in the range 0 (or 00) to 23. Specify minutes as mm in the range 0 (or 00) to 59.

/recurrencestart

Specify a date for a recurring service to start.

Use this option with the /recurrencepattern option, and the /recurrencetime option.

When this option is specified, the following conditions will result in an error:

  • A combination of arguments that is not valid.
  • The form of the specified date is inaccurate.
  • The specified date is outside the range on January 1, 1994 to December 31, 2036.

Format:

Specify the date in the form of "yyyy-mm-dd." Specify the year as yyyy in four digits. Specify the month as mm in the range 1 (or 01) to 12. Specify a day as dd in the range 1 (or 01) to 31.

/reregister

Specify to reregister scheduled tasks.

This option has no value.

/taskdetaildir

Specify a folder that was output by the listtasks command with the /taskdetails option. Use an absolute or relative path.

The folder must be located on a local disk.

The maximum path length is 180 characters.

/setoriginalsubmitter

Specify whether you want to reregister tasks as the user at the point in time in which task details were output.

This option has no value.

When this option is not specified, the user ID specified as the /user of the submittask command serves as the assigned user of the task after reregistration.

/authmode local | external Specify the authentication type, either local or external. Specify local to authenticate locally with Automator. Specify external to authenticate with Common Services. If this option is not specified, Ops Center Automator operates in the authentication mode specified by the command.auth.mode of command_user.properties.
/help

Show command syntax and usage.

Command location

installation-folder\bin

Return codes

The following table lists the submittask command return codes and descriptions.

Return code Description
0 The command succeeded.
1 The argument is not valid.
2 The command stopped.
3 The service status is not valid.
4 The number of commands that can be run simultaneously is exceeded.
5 Communication failed.
6 Authentication failed.
7 A path is specified that is not valid.
9 Path not found.
10 Path cannot be accessed.
14 You do not have permission to run the command.
17 The interactive input value is not valid.
130 The service did not start.
131 The properties file does not exist.
132 The properties file has a format that is not valid.
133 The command with /wait option failed to get the current command status.
134 The task failed.
135 The task was canceled.
136 The contents of the folder specified by the /taskdetails option are not valid.
137 Some part of the tasks failed to be registered by the command with the /reregister option.
138 All tasks failed to be registered by the command with the /reregister option.
139

The content of task detail folder is different from the current version or revision.

255 The command stopped due to an error other than the ones listed in this table.

Example: Immediate execution of a service

submittask /servicename "Execute Remote Command"
        /servicegroup "Default Service Group"
        /taskname "Submittask sample"
        /taskdescription "This is a sample."
        /property common.targetHost host01 /property common.remoteCommand ipconfig
        /user Bob

Example: Scheduled execution of a service

submittask /servicename "Execute Remote Command"  
        /propertyfile "C:\temp\properties.txt"
        /scheduledate 2020-01-23 /scheduletime 12:34
        /user Bob
        

Example: Recurrent execution of a service

submittask /servicename "Execute Remote Command" 
        /propertyfile "C:\temp\properties.txt"
        /recurrencepattern weekly:sun,mon,sat
        /recurrencetime 12:34 /recurrencestart 2020-01-23
        /user Bob

Example: Reregistration of tasks

submittask /reregister /taskdetaildir "C:\temp\taskdetails"
        /user Bob