Append
This commit is contained in:
parent
1b9c4ffcbc
commit
7285aa7cd4
@ -49,55 +49,6 @@ HELP
|
|||||||
exit 0
|
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() {
|
get_bricks() {
|
||||||
MY_HOSTNAME=$(echo "${HOSTNAME}" | cut -d '.' -f 1)
|
MY_HOSTNAME=$(echo "${HOSTNAME}" | cut -d '.' -f 1)
|
||||||
if ! BRICKS=$(gluster vol info "${REPO}" | grep -i "${MY_HOSTNAME}" | grep -o 'brick[0-9]\+'); then
|
if ! BRICKS=$(gluster vol info "${REPO}" | grep -i "${MY_HOSTNAME}" | grep -o 'brick[0-9]\+'); then
|
||||||
@ -157,6 +108,56 @@ scan_paths() {
|
|||||||
done
|
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
|
# Main Main Main
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user