# jobman.sh

The **jobman.sh** CLI is stored in the /ceman/bin and has 3 commands:

1. **help**: shows the description of the command.
2. **execute-on-jobs**: given an input and an output file in CSV format, it applies specific actions to a set of Jobs.
3. **list**: provides a list of Jobs according to the given filter.

## Full list of parameters

Run `jobman.sh/help` to have the full list of parameters in alphabetical order.

```shell
root@ceman:/ceman/bin#./jobman.sh help
Usage: jobman [-hLV] [-c=<charset>] [-C=<connectTimeoutseconds>]
[-e=<secureEndpoint>] -o=<OutputFile> [-R=<readTimeoutseconds>]
-u=<username> (-p=<passwordFile> | -P) [COMMAND]
```

The parameters in **square brackets** are **optional**. Parameters **without square brackets** are **mandatory**.\
Let's have a closer look.

### Optional parameters

* **\[-c, --charset=\<charset>]**: charset used to read and write files. The default is UTF-8.
* **\[-C, --connect-timeout-seconds=\<connectTimeoutseconds>]**: connection timeout that can be set on the connection. The default is 300 seconds (5 minutes).
* **\[-e, --endpoint=\<secureEndpoint>]**: CEMAN instance the command line must point to. The instance must be specified in the <https://ceman:9443> format. The parameter is optional since the command detects the https port of the CEMAN where the command line is running and connects automatically.
* **\[-h, --help]**: shows the help. Added to a command, information about the command is given.
* **\[-L, --enable-console-log]**: enables information at console log level. This is useful for the help desk and for troubleshooting.
* **\[-R, --read-timeout-seconds=\<readTimeoutSeconds>]**: read timeout that can be set on the connection. The default is 300 seconds (5 minutes).
* **\[-V, --version**]: prints version information and exits.

### Mandatory parameters

* **-o, --output-file=\<outputFile>**: relative or absolute path of the output CSV file.
* **-u, --username=\<username>**: user connecting to the system.

{% hint style="danger" %}
**Warning!**

The user must be an administrative user, i.e., it must belong to the "Administrators" group. This is the same type of user that is currently used to operate on the Job Manager from the UI.
{% endhint %}

* **-p, --password-file=\<passwordFile>** and **-P, --password**: parameters used to specify the user's password. You can choose between:
  * **-p, --password-file=\<passwordFile>**: the user's password is specified in a file, in plain text and a single line.
  * **-P, --password**: the password is typed on the console interactively.
* **\[COMMAND]**: command to be executed. **help** is the command to display the help; **execute-on-jobs** is the command to execute actions on a list of jobs; **list** is the command for a list of actions.\
  **help + \<command>** provides information about the command. The picture below shows the result of the **jobman.sh help list** command:

<figure><img src="https://files.readme.io/66e3642-JobmanHelpList.jpg" alt="" width="375"><figcaption></figcaption></figure>

The final section provides information about timestamp processing. It contains the format expected by the command line. It is the ISO 8601 with the optional TimeZone. If it is not set, the default of the operating system is used. Z indicates the absolute UTC format, but it can also be set in the hours:minutes format.

![](https://files.readme.io/00d3189-time_format.png)

## How to use commands and parameters

### Example: Listing jobs in ERROR

To have a .csv file with the list of jobs in status ERROR, we must set the parameters in this way:

`./jobman.sh -u=admin-superuser -P -o=list.csv list --job-status=ERROR`

Where:

* **-u=admin-superuser**: username
* **-P**: the password will be entered in interactive mode
* **-o=list.csv**: name of the output file
* **list**: command
* **--job-status=ERROR**: only jobs in this status will be listed

The command will produce the list.csv file with these columns:

* **job\_id**: ID of the job
* **status**: can be Submitted, Suspended, Running, Completed, Error or Aborted
* **contract\_name**: name of the contract
* **flow\_template\_name**: name of the Flow Template
* **flow\_template\_revision**: revision of the Flow Template
* **queue\_name**: name of the queue
* **submission\_date**: timestamp of the submission date
* **last\_event\_date**: timestamp of the last job event
* **version**: internal use to have fine-grained versioning of the job

This list is useful to execute actions with the **execute-on-jobs** command (which uses the job\_id and the version).

The **execute-on-jobs** command has 2 mandatory parameters:

1. **\<action>**: the action that must be performed on the jobs. Possible values are: **abort, abort-resubmit, change-queue, resubmit, resume, suspend**.\
   This parameter also lists the actions available for each job status:\
   • SUBMITTED: abort, change-queue, suspend\
   • SUSPENDED: abort, change-queue, resume\
   • RUNNING: abort\
   • COMPLETED: resubmit\
   • ERROR: abort, abort-resubmit, change-queue, resume\
   • ABORTED: resubmit
2. **-i, --input-file=\<inputFile>**: name of the input file, in CSV format.

For the **resume**, **abort** and **suspend** actions, the **job\_id** and **version columns** are mandatory.\
For the **change-queue** action, the **job\_id**, **version** and **change\_queue\_name columns** are mandatory.\
For the **abort-resubmit** and **resubmit** actions, the **job\_id**, **version** and **resubmit\_queue\_name columns** are mandatory.

{% hint style="warning" %}
The resubmit\_queue\_name and change\_queue\_name columns must be added manually.
{% endhint %}

## Example: Resuming two jobs

Let's go on with our example and resume two jobs.\
We set these parameters:

`./jobman.sh -u=admin-superuser -P -o=result.csv execute-on-jobs -i=list.csv resume`

Where:

* **-u=admin-superuser**: username
* **-P**: the password will be entered in interactive mode
* **-o=result.csv**: name of the output file
* **execute-on-jobs**: command
* **-i=list.csv**: name of the input file
* **resume**: action to be applied

The result will be:

![](https://files.readme.io/978c628-example_1.png)

As you can see, each row is updated with:

1. **\<action>**: the action required, in our example, RESUME.
2. **\<action\_result>**: the outcome of the action, in our example SUCCESS.
3. **\<action\_timestamp>**: when the operation was performed.

In case of FAILURE, these columns will be added:

1. **\<action\_failure\_code>**
2. **\<action\_failure\_message>**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-mover-1.21/cli-and-configuration-files/jobman.sh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
