Skip to content

Commit

Permalink
Remove unnecessary echoerr function in run scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Apr 29, 2024
1 parent e8fd308 commit 37d3ae4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions src/distribution/bin/diagnostics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ echo ''
echo ' DIAGNOSTIC MODE'
echo ''

echoerr() { printf "%s\n" "$*" >&2; }

if ! hash java 2>/dev/null; then
echoerr 'ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptium.net/?variant=openjdk11 and try again.'
echo 'ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptium.net/?variant=openjdk11 and try again.' >&2
exit 1
fi

JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/\..*//')

if [ "$JAVA_VERSION" -lt 11 ]; then
echoerr 'HiveMQ requires at least Java version 11'
echo 'HiveMQ requires at least Java version 11' >&2
exit 1
fi

Expand Down Expand Up @@ -72,18 +70,18 @@ fi
HOME_OPT="-Dhivemq.home=$HIVEMQ_HOME"

if [ ! -d "$HIVEMQ_HOME" ]; then
echoerr 'ERROR! HiveMQ Home Folder not found.'
echo 'ERROR! HiveMQ Home Folder not found.' >&2
exit 1
fi

if [ ! -w "$HIVEMQ_HOME" ]; then
echoerr 'ERROR! HiveMQ Home Folder Permissions not correct.'
echo 'ERROR! HiveMQ Home Folder Permissions not correct.' >&2
exit 1
fi

JAR_PATH="$HIVEMQ_HOME/bin/hivemq.jar"
if [ ! -f "$JAR_PATH" ]; then
echoerr 'ERROR! HiveMQ JAR not found.'
echo 'ERROR! HiveMQ JAR not found.' >&2
exit 1
fi

Expand Down
12 changes: 5 additions & 7 deletions src/distribution/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@ echo ''
echo ' HiveMQ Start Script for Linux/Unix v1.14'
echo ''

echoerr() { printf "%s\n" "$*" >&2; }

if ! hash java 2>/dev/null; then
echoerr 'ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptium.net/?variant=openjdk11 and try again.'
echo 'ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptium.net/?variant=openjdk11 and try again.' >&2
exit 1
fi

JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/\..*//')

if [ "$JAVA_VERSION" -lt 11 ]; then
echoerr 'HiveMQ requires at least Java version 11'
echo 'HiveMQ requires at least Java version 11' >&2
exit 1
fi

Expand Down Expand Up @@ -71,18 +69,18 @@ fi
HOME_OPT="-Dhivemq.home=$HIVEMQ_HOME"

if [ ! -d "$HIVEMQ_HOME" ]; then
echoerr 'ERROR! HiveMQ Home Folder not found.'
echo 'ERROR! HiveMQ Home Folder not found.' >&2
exit 1
fi

if [ ! -w "$HIVEMQ_HOME" ]; then
echoerr 'ERROR! HiveMQ Home Folder Permissions not correct.'
echo 'ERROR! HiveMQ Home Folder Permissions not correct.' >&2
exit 1
fi

JAR_PATH="$HIVEMQ_HOME/bin/hivemq.jar"
if [ ! -f "$JAR_PATH" ]; then
echoerr 'ERROR! HiveMQ JAR not found.'
echo 'ERROR! HiveMQ JAR not found.' >&2
exit 1
fi

Expand Down

0 comments on commit 37d3ae4

Please sign in to comment.