You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
348 B
Bash
30 lines
348 B
Bash
2 years ago
|
#! /bin/shell
|
||
|
|
||
|
hasJdk(){
|
||
|
RESULT=$(pgrep java)
|
||
|
if [[ ! $RESULT ]]
|
||
|
then
|
||
|
return 0;
|
||
|
fi
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
hasJdk
|
||
|
if [ $? != 1 ]
|
||
|
then
|
||
|
echo "Not Found jdk"
|
||
|
echo "Installing jdk..."
|
||
|
yum install -y java-1.8.0-openjdk
|
||
|
hasJdk
|
||
|
if [ $? != 1 ]
|
||
|
then
|
||
|
echo "Install jdk Fail"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
java -version
|
||
|
echo ""
|
||
|
|
||
|
|
||
|
|