Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleDeprecation Announcement

The functionality of the script presented in the article is migrated to JS7 - Unix Shell CLI for Workflow Status Operations

Users can continue to use the below script, no maintenance is provided.

Table of Contents

Introduction

...

The Script requires the jq utility to be available from the operating system. 

jq is ships with the MIT license, see https://opensource.org/licenses/MIT.

...

  • --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..
  • --date
    • Specifies the date in ISO format for which notices will be deleted. The default value <yesterday> indicates the previous day.
      • An absolute date has to be specified, for example 2023-10-23 will affect notices created for that date. 
    • Dates can be calculated from the date command.
      • --date="$(TZ=Europe/London date --date="1 day ago" +'%Y-%m-%d')" specifies to delete notices created for a date before the current day in the Europe/London time zone.
      • --date="$(TZ=Europe/London date --date="2 day ago" +'%Y-%m-%d')" specifies to delete notices created for execution a day before yesterday.
  • --time-zone
  • --folders
    • Specifies one or more JOC Cockpit inventory folders from absolute paths - separated by comma - holding notice boards for which notices have been created.
    • For example --folders=/ProductDemo/CyclicExecution,/ProductDemo/ScheduledExecution will delete notices created for notice boards in the given folders.
    • If the --recursive switch is used then sub-folders will be looked up recursively.
  • --notice-boards
    • Specifies one or more notice boards - separated by comma - from which notices will be deleted.
    • For example --notice-boards=/ProductDemo/CyclicExecution/Begin-of-Day,/ProductDemo/ScheduledExecution/End-of-Day will consider notices from the Begin-of-Day and End-of-Day notice boards in the given folders.
  • --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_resourcedelete-notices.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.log
    • For example: set_job_resourcedelete-notices.2022-03-19T20-50-45.log

Switches

...

Code Block
titleExample for Deleting Notices
linenumberstrue
./delete-notices.sh \
    --url=https://joc-2-0-primary:7443 \
    --cacert=/home/sos/jstest/certs/root-ca.pem \
    --user=root \
    -p \
    --controller-id=controller \
    --date-to="$(TZ=Europe/London date --date="2 day ago" +'%Y-%m-%d')" \
    --time-zone=Europe/London
 
# deletes notices for the Daily Plan date two days ago
# establishes the connection to JOC Cockpit by HTTPS and the Root CA Certificate is specified from the path to a .pem file
# asks the user for interactive keyboard input of the password used for the account specified
# specifies the date from an individual time zone

...

Code Block
titleExample for Deleting Notices
linenumberstrue
./delete-notices.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \
    --notice-boards=/ProductDemo/CyclicExecution/Begin-of-Day,/ProductDemo/ScheduledExecution/End-of-Daily-EOD

# deletes notices created for the previous day (default)
# limits deletion to notices created by the given list of notice boards

Further Resources