ul11u4 gate open checks for queued RTIs
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
trap 'exit 1' HUP INT QUIT TERM
|
trap 'exit 1' HUP INT QUIT TERM
|
||||||
|
|
||||||
|
trap 'on_error' EXIT
|
||||||
|
|
||||||
log::prefix() {
|
log::prefix() {
|
||||||
date=$(gdate '+%Y-%m-%d %H:%M:%S,%3N')
|
date=$(gdate '+%Y-%m-%d %H:%M:%S,%3N')
|
||||||
printf '%s %s\n' "${date}" "${*}"
|
printf '%s %s\n' "${date}" "${*}"
|
||||||
@@ -31,11 +33,13 @@ log::error() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log::fatal() {
|
log::fatal() {
|
||||||
reason='Unknown or not specified'
|
reason="${1-Unknown or not specified}"
|
||||||
if [ "$1" ]; then
|
|
||||||
reason=$1
|
|
||||||
fi
|
|
||||||
log::error "Fatal error. Reason: ${reason}"
|
log::error "Fatal error. Reason: ${reason}"
|
||||||
kill -s TERM $$
|
kill -s TERM $$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_error() {
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log::fatal "Unhandled script failure"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# shellcheck disable=SC1091,SC2015
|
|
||||||
|
|
||||||
[[ "$0" == /* ]] && typeset -r PRG=$0 || typeset -r PRG=$PWD/$0
|
[[ "$0" == /* ]] && typeset -r PRG=$0 || typeset -r PRG=$PWD/$0
|
||||||
|
|
||||||
BINDIR=$(dirname "$PRG")
|
BINDIR=$(dirname "$PRG")
|
||||||
@@ -9,14 +7,21 @@ typeset -r BINDIR
|
|||||||
|
|
||||||
source "${BINDIR}/lib/logging.sh"
|
source "${BINDIR}/lib/logging.sh"
|
||||||
|
|
||||||
TARGET=$1
|
TARGET="${1-11.4.81.0.1.195.1}"
|
||||||
|
|
||||||
|
URL="http://grt.us.oracle.com/grt/webservice/grtList/?gate=20&show=All&gateName=S11.4-SRU&status=1&target=${TARGET}"
|
||||||
|
|
||||||
if [ -z "$TARGET" ];
|
out=$(w3m "$URL" -M -cols 400 -graph -dump | awk '/^Details/ {found=1; next} found && NF')
|
||||||
|
|
||||||
|
if [[ -z "$out" ]];
|
||||||
then
|
then
|
||||||
log::fatal "No target specified on command line"
|
log::info "There are no queued RTIs for \"${TARGET}\". Nothing to do..."
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
log::info "Opening the gate for ${TARGET}"
|
||||||
|
|
||||||
log::debug "Starting gate open for Ul11u4SRU"
|
log::debug "Starting gate open for Ul11u4SRU"
|
||||||
log::debug "Target: \"${TARGET}\""
|
log::debug "Target: \"${TARGET}\""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user