working on watch-containers.sh
This commit is contained in:
parent
bbf76a26be
commit
8b79cd6fbc
|
@ -47,7 +47,7 @@ ONLY_IN_CURRENT=()
|
|||
# Print help information
|
||||
function print_help() {
|
||||
printf "%s\n\n%s\n%b\n\n%s\n %-15s %s\n %-15s %s\n %-15s %s\n %-15s %s\n %-15s %s\n" \
|
||||
"$DESCRIPTION" "Usage:" "$LIB_BOLD$EXECUTABLE <options> <healthchecks-url>$LIB_CLEAR" "Options:" \
|
||||
"$DESCRIPTION" "Usage:" "$LIB_BOLD$EXECUTABLE <options> [healthchecks-url]$LIB_CLEAR" "Options:" \
|
||||
"-s, --state" "Save current state to file and exit" \
|
||||
"-h, --help" "Print help screen and exit" \
|
||||
"-i, --info" "Print script information and exit" \
|
||||
|
@ -160,17 +160,24 @@ for I in "${CURRENT[@]}"; do
|
|||
fi
|
||||
done
|
||||
|
||||
# Print result
|
||||
echo "Missing container(s): ${ONLY_IN_CACHE[@]}"
|
||||
echo "New container(s): ${ONLY_IN_CURRENT[@]}"
|
||||
# Construct result
|
||||
if [[ -n "${ONLY_IN_CACHE[@]}" ]] && [[ -n "${ONLY_IN_CURRENT[@]}" ]]; then
|
||||
RESULT=$(printf "Missing containers: %s\nNew containers: %s\n" "${ONLY_IN_CACHE[@]}" "${ONLY_IN_CURRENT[@]}")
|
||||
elif [[ -n "${ONLY_IN_CACHE[@]}" ]]; then
|
||||
RESULT=$(printf "Missing containers: %s\n" "${ONLY_IN_CACHE[@]}")
|
||||
elif [[ -n "${ONLY_IN_CURRENT[@]}" ]]; then
|
||||
RESULT=$(printf "New containers: %s\n" "${ONLY_IN_CURRENT[@]}")
|
||||
fi
|
||||
|
||||
#if [[ -z "$1" ]]; then
|
||||
# print_help
|
||||
# exit 0
|
||||
#else
|
||||
|
||||
#fi
|
||||
# Post result to Healthchecks
|
||||
if [[ -n "$1" ]]; then
|
||||
if lib_is_url "$1"; then
|
||||
lib_healthchecks "$1" "$RESULT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Print result to screen
|
||||
printf "%s\n" "$RESULT"
|
||||
|
||||
##
|
||||
## Here be dragons
|
||||
|
|
Loading…
Reference in New Issue