Versions Compared

Key

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

...

  • The script is available for Linux and MacOS® using bash shellsshell.
  • The script terminates with exit code 0 to signal successful cancellation, with exit code 1 for command line argument errors and with exit code 4 for non-recoverable errors. Exit code 3 signals that no matching orders have been found.
  • The script is intended as a baseline example for customization by JS7 users and by SOS within the scope of professional services.

...

  • -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 for secure interactive input as an alternative to use of the option --password=<password>.
  • -r | --recursive
    • Specifies that folders should will be looked up recursively if the --folders option is used.
  • -k | --kill
    • Specifies that tasks of running orders should will be killed.
    • If used without the --sigterm switch then orders are immediately killed using a SIGKILL signal corresponding to the command: kill -9.
  • -t | --sigterm
    • Specifies that a SIGTERM signal will be sent to tasks of running orders if the --kill switch is used.
    • The switch allows shell jobs that implement traps to perform some clean-up and to gracefully terminate before being killed by a SIGKILL signal.
  • -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 have been successfully cancelledinitiated
  • 1: argument errors
  • 3: no orders found
  • 4: is returned if the JS7 REST Web Service is not reachable or reports errors

...

Code Block
titleExample for Cancelling Orders
linenumberstrue
./cancel-orders.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \ 
    --date-to="$(date +'%Y-%m-%d')T00:00:00"

# cancels all orders scheduled for a date before begin of the current day
# limits cancellation to orders in the SCHEDULED state (default) 
# implies that the system time zone is used (default)

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

Code Block
titleExample for Cancelling Orders
linenumberstrue
./cancel-orders.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="1 day ago" +'%Y-%m-%d')T00:00:00" \
    --time-zone=Europe/London \
    --states=FAILED,SUSPENDED
 
# cancels all orders scheduled for a date before yesterday
# 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
# limits cancellation to orders in the FAILED orand SUSPENDED state

Cancel late orders from a list of folders

Code Block
titleExample for Cancelling Orders
linenumberstrue
./cancel-orders.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \ 
    --date-to="$(date +'%Y-%m-%d')T00:00:00" \
    --folders=/ProductDemo/CyclicExecution,/ProductDemo/ScheduledExecution \
    --recursive

# cancels late orders scheduled for yesterday's Daily Plan date
# limits cancellation to orders scheduled in the SCHEDULED state (default) for workflows from the given folders
# looks up sub-folders recursively

...

Code Block
titleExample for Cancelling Orders
linenumberstrue
./cancel-orders.sh \
    --url=http://joc-2-0-primary:7446 \
    --user=root \
    --password=root \
    --controller-id=controller \
    --date-to="$(date +'%Y-%m-%d')T00:00:00" \
    --workflows=/ProductDemo/CyclicExecution/Cyclic-Check,/ProductDemo/ScheduledExecution/Daily-EOD

# cancels late orders scheduled for yesterday's Daily Plan date
# limits cancellation to orders scheduled in the SCHEDULED state (default) for the given list of workflows