Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Download: switch-subagent-cluster.sh

Usage

Invoking the script without arguments displays the usage clause:


Code Block
titleUsage
Usage: switch-subagent-cluster.sh [Options] [Switches]

  Options:
    --url=<url>                         | required: JOC Cockpit URL
    --controller-id=<identifier>        | required: Controller ID
    --user=<account>                    | required: JOC Cockpit user account
    --password=<password>               | optional: JOC Cockpit password
    --ca-cert=<path>                    | optional: path to CA Certificate used for JOC Cockpit login
    --client-cert=<path>                | optional: path to Client Certificate used for login
    --client-key=<path>                 | optional: path to Client Key used for login
    --agent-cluster-id=<identifier>     | required: ID of the Agent Cluster
    --subagent-cluster-id=<identifier>  | required: ID of the Subagent Cluster
    --active=<identifier>               | optional: Identifier of the Subagent that should become active
    --log-dir=<directory>               | optional: path to the directory holding the script's batch log files

  Switches:
    -h | --help                         | displays usage
    -v | --verbose                      | displays verbose output
    -p | --password                     | asks for password
    -c | --check                        | checks which Subagents are configured and displays results
    -s | --switch                       | specifies that active Subagent and next standby Subagent should be switched
    --show-logs                         | shows log output if --log-dir is used
    --make-dirs                         | creates directories if they do not exist


Options

  • --url
  • --controller-id
    • Specifies the identification of the Controller that holds related orders.
  • --user
    • Specifies the user account for login to JOC Cockpit. If JS7 - Identity Services are available for Client authentication certificates that are specified with the --client-cert and --client-key options then their common name (CN) attribute has to match the user account.
    • If a user account is specified then a password can be specified using the --password option or interactive keyboard input can be prompted using the -p switch.
  • --password
    • Specifies the password used for the account specified with the --user option to login to JOC Cockpit.
    • Consider use of the -p switch offering a secure option for interactive keyboard input.
  • --cacert
    • Specifies the path to a .pem file that holds the Root CA Certificate and optionally Intermediate CA Certificates to verify HTTPS connections to JOC Cockpit.
  • --client-cert
    • Specifies the path to a .pem file that holds the Client Certificate if HTTPS mutual authentication is used..
  • --client-key
    • Specifies the path to a .pem file that holds the Client Privae Key if HTTPS mutual authentication is used..
  • --agent-cluster-id
    • Specifies the Identifier of an existing Agent Cluster.
  • --subagent-cluster-id
    • Specifies the identifier of an existing Subagent Cluster.
  • --active
    • Specifies the Subagent ID of a specific Subagent that should take the active role.
    • The Subagent will be assigned the highest priority in the Subagent Cluster.
  • --log-dir
    • If a log directory is specified then the script will log information about processing steps to a log file in this directory.
    • File names are created according to the pattern: set_job_resource.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.log
    • For example: set_job_resource.2022-03-19T20-50-45.log

Switches

  • -h | --help
    • Displays usage.
  • -p | --password
    • Asks the user for interactive keyboard input of the password used for the account specified with the --user option..
    • The switch is used to secure interactive input as an alternative to use of the option --password=<password>.
  • -c | --check
    • Displays the list of Subagents in the given Subagent Cluster.
    • The switch cannot be used with the --switch switch and with the --active option..
  • -s | --switch
    • Specifies that the Subagent with highest priority and the next Subagent should switch the active role.
    • The switch cannot be used with the --check switch and with the --active option..
  • -v | --verbose
    • Displays verbose log output.
  • --show-logs
    • Displays the log output created by the script if the --log-dir option is used.
  • --make-dirs
    • If directories are missing that are indicated with the --log-dir option then they will be created.

Exit Codes

  • 0: cancellation of orders successfully initiated
  • 1: argument errors
  • 3: no Subagent Cluster found
  • 4: JS7 REST Web Service is not reachable or reports errors

Examples

The following examples illustrate typical use cases.

Check the list of Subagents and Priorities in a given Subagent Cluster

Code Block
titleExample for Cancelling Orders
linenumberstrue
./switch-subagent-cluster.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \
    --agent-cluster-id=agent_cluster_001 \
    --subagent-cluster-id=active-passive-all-agents \
    --check

# displays the list of Subagents und priorities in the given Subagent Cluster
# does not modify the Subagent Cluster

Switch the active role from the Subagent with highest priority to the Subagent with next priority

Code Block
titleExample for Cancelling Orders
linenumberstrue
./switch-subagent-cluster.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \
    --agent-cluster-id=agent_cluster_001 \
    --subagent-cluster-id=active-passive-all-agents \
    --switch

# switches the active role from the Subagent with the highest priority in the given Subagent Cluster to the Subagent with the next priority

Cancel failed and suspended orders to a Daily Plan date two days ago

Code Block
titleExample for Cancelling Orders
linenumberstrue
./switch-subagent-cluster.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \
    --agent-cluster-id=agent_cluster_001 \
    --subagent-cluster-id=active-passive-all-agents \
    --active=secondary_director_001

# makes the Subagent with ID "secondary_director_001" the active Subagent in the given Subagent Cluster