Check, if all required programs are installed

This commit is contained in:
Andreas Bauer
2017-08-04 15:34:18 +02:00
parent e8e758c8dd
commit 88b2ee2be9
+18
View File
@@ -43,6 +43,24 @@ print_help() {
crit=2 crit=2
fcp=0.1 fcp=0.1
#check required tools
check_executable() {
if [ -z "$1" ]; then
echo "check_executable: no parameter given!"
exit $ST_UK
fi
if [ -z "$(which $1)" ]; then
echo "UNKNOWN: Cannot find $1"
exit $ST_UK
fi
}
check_executable mysql
check_executable bc
if (( $# == 0 )); then if (( $# == 0 )); then
echo "UNKNOWN: No parameter given! Please use -h for help!" echo "UNKNOWN: No parameter given! Please use -h for help!"
exit $ST_UK exit $ST_UK