nagios-scripts/check-dummy.sh

61 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash
#
#/
#/ Usage:
#/ check-dummy.sh
#/
#/ Does not check anything. Always gives OK!
#/
#/
#/ Exit Codes:
#/ 0 Everything OK
#/
Usage() {
grep '^#/' "${script_dir}/${script_name}" | sed 's/^#\/\w*//'
}
GetOptions() {
# https://stackoverflow.com/a/29754866
OPTIONS=''
LONGOPTS=''
# -use ! and PIPESTATUS to get exit code with errexit set
# -temporarily store output to be able to check for errors
# -activate quoting/enhanced mode (e.g. by writing out “--options”)
# -pass arguments only via -- "$@" to separate them correctly
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
# e.g. return value is 1
# then getopt has complained about wrong arguments to stdout
Usage
exit 2
fi
# read getopt's output this way to handle the quoting right:
eval set -- "$PARSED"
# now enjoy the options in order and nicely split until we see --
while true; do
case "$1" in
--)
shift
break
;;
*)
echo "URL UNKNOWN - ${1} is not a valid parameter"
exit 3
;;
esac
done
if [ -z ${1+x} ]; then
echo "URL UNKNOWN - url not given"
exit 3
else
url=${1}
fi
}
echo "DUMMY OK"
exit 0