1
1
Fork 0

working on watch-containers.sh

This commit is contained in:
david 2023-10-31 21:54:21 +01:00
parent bbf76a26be
commit 8b79cd6fbc
1 changed files with 17 additions and 10 deletions

View File

@ -47,7 +47,7 @@ ONLY_IN_CURRENT=()
# Print help information # Print help information
function print_help() { 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" \ 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" \ "-s, --state" "Save current state to file and exit" \
"-h, --help" "Print help screen and exit" \ "-h, --help" "Print help screen and exit" \
"-i, --info" "Print script information and exit" \ "-i, --info" "Print script information and exit" \
@ -160,17 +160,24 @@ for I in "${CURRENT[@]}"; do
fi fi
done done
# Print result # Construct result
echo "Missing container(s): ${ONLY_IN_CACHE[@]}" if [[ -n "${ONLY_IN_CACHE[@]}" ]] && [[ -n "${ONLY_IN_CURRENT[@]}" ]]; then
echo "New container(s): ${ONLY_IN_CURRENT[@]}" 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 # Post result to Healthchecks
# print_help if [[ -n "$1" ]]; then
# exit 0 if lib_is_url "$1"; then
#else lib_healthchecks "$1" "$RESULT"
fi
#fi fi
# Print result to screen
printf "%s\n" "$RESULT"
## ##
## Here be dragons ## Here be dragons