This commit is contained in:
Thomas Gebert 2026-05-13 14:19:25 +02:00
parent 1b9c4ffcbc
commit 7285aa7cd4

View File

@ -49,55 +49,6 @@ HELP
exit 0
}
################################################################################
# Argument parser
################################################################################
die() {
printf '%s\n' "$1" >&2
exit 1
}
while :; do
case $1 in
-h|-\?|--help)
show_help # Display a usage synopsis.
exit
;;
-r|--repo)
if [ "$2" ]; then
REPO=$2
shift
else
die 'ERROR: "-r|--repo" requires a non-empty option argument.'
fi
;;
-m|--mode)
if [ "$2" ]; then
MODE=$2
shift
else
die 'ERROR: "-r|--repo" requires a non-empty option argument.'
fi
;;
-t|--timeout)
if [ "$2" ]; then
TIMEOUT=$2
shift
else
die 'ERROR: "-t|--timeout" requires a non-empty option argument.'
fi
;;
--) # End of all options.
shift
break
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
get_bricks() {
MY_HOSTNAME=$(echo "${HOSTNAME}" | cut -d '.' -f 1)
if ! BRICKS=$(gluster vol info "${REPO}" | grep -i "${MY_HOSTNAME}" | grep -o 'brick[0-9]\+'); then
@ -157,6 +108,56 @@ scan_paths() {
done
}
################################################################################
# Argument parser
################################################################################
die() {
printf '%s\n' "$1" >&2
exit 1
}
while :; do
case $1 in
-h|-\?|--help)
show_help # Display a usage synopsis.
exit
;;
-r|--repo)
if [ "$2" ]; then
REPO=$2
shift
else
die 'ERROR: "-r|--repo" requires a non-empty option argument.'
fi
;;
-m|--mode)
if [ "$2" ]; then
MODE=$2
shift
else
die 'ERROR: "-r|--repo" requires a non-empty option argument.'
fi
;;
-t|--timeout)
if [ "$2" ]; then
TIMEOUT=$2
shift
else
die 'ERROR: "-t|--timeout" requires a non-empty option argument.'
fi
;;
--) # End of all options.
shift
break
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
################################################################################
# Main Main Main
################################################################################