#!/bin/sh



#########################################################################



# WAS Install automation script #



# #



# Wildfly : Ver 1.1.0 / 2018.11.19 #



# Created by kt ds OpenSource Team #



#########################################################################






echo `date` >> INSTALL_MESSAGE







#arguments

check






echo “=== check arguments”



if [ $# != 4 ]; then



echo “Usage : Please type $0 Service_Name host_num Service_IP instance_num ex) $> $0 olleh 1 0.0.0.0 1” >> INSTALL_MESSAGE



echo “Invalid Argument” >> INSTALL_MESSAGE



exit 0;



fi






if [ $1 == “inst” ]; then



echo “Cannot use with name ‘inst’ for first argument. Take another instance name.”



echo “Cannot use with name ‘inst’ for first argument. Take another instance name.” >> INSTALL_MESSAGE



exit 0;



fi






module_openjdk7=`rpm -qa | grep -c java-1.7.0-openjdk-1.7.0`



module_openjdk7_devel=`rpm -qa | grep -c java-1.7.0-openjdk-devel`



module_openjdk8=`rpm -qa | grep -c java-1.8.0-openjdk-1.8.0`



check_yum_stability=`ps -ef |grep yum | grep -v grep |wc -l`






if [ “$module_openjdk7” = “0” ]; then



echo “[INFO]OpenJDK7 was not installed” >> INSTALL_MESSAGE



echo “[INFO]install OpenJDK7 (yum)” >> INSTALL_MESSAGE



if [ “$check_yum_stability” = “0” ]; then



yum -y install java-1.7.0-openjdk



else



echo “[ERROR]not ready to use yum repository” >> INSTALL_MESSAGE



exit 0;



fi



module_openjdk7=`rpm -qa | grep -c java-1.7.0-openjdk-1.7.0`



if [ “$module_openjdk7” = “0” ]; then



echo “[ERROR]tried but OpenJDK7 was not installed” >> INSTALL_MESSAGE



echo “[ERROR]please install java-1.7.0-openjdk” >> INSTALL_MESSAGE



exit 0;



fi



fi






if [ “$module_openjdk7_devel” = “0” ]; then



echo “[INFO]OpenJDK7-devel was not installed” >> INSTALL_MESSAGE



echo “[INFO]install OpenJDK7-devel (yum)” >> INSTALL_MESSAGE



if [ “$check_yum_stability” = “0” ]; then



yum -y install java-1.7.0-openjdk-devel



else



echo “[ERROR]not ready to use yum repository” >> INSTALL_MESSAGE



exit 0;



fi



module_openjdk7_devel=`rpm -qa | grep -c java-1.7.0-openjdk-devel`



if [ “$module_openjdk7_devel” = “0” ]; then



echo “[ERROR]tried but OpenJDK7-devel was not installed” >> INSTALL_MESSAGE



echo “[ERROR]please install java-1.7.0-openjdk-devel” >> INSTALL_MESSAGE



exit 0;



fi



fi






if [ “$module_openjdk8” = “0” ]; then



echo “[INFO]OpenJDK8 was not installed” >> INSTALL_MESSAGE



fi










#check

install user



echo “=== check install user”



current_user=`whoami`



if [ “$current_user” != “root” ]; then



echo “[ERROR] $current_user is invalid user to install” >> INSTALL_MESSAGE



echo “Please login by root user” >> INSTALL_MESSAGE



exit 0;



fi







#check

was user exist, check current directory



echo “=== check user”



jboss_user=”jboss”









current_dir=`pwd`



check_user=`awk -F”:” ‘{print $1}’ /etc/passwd | grep -c ^”$jboss_user”$`



if [ “$current_dir” = “/jboss” ]; then



if [ “$check_user” != “0” ]; then



WAS=”jboss”



WASENGINEDIR=”/jboss”



WASLOGDIR=”/jb_log”



else



echo “[ERROR] jboss user is not exist” >> INSTALL_MESSAGE



exit 0;



fi



else



echo “[ERROR] Invalid directory to install” >> INSTALL_MESSAGE



echo “[ERROR] current directory : $current_dir” >> INSTALL_MESSAGE



exit 0;



fi







#version



echo “=== check WAS S/W version”



jboss=jboss-as-7.1.1.Final



wildfly=wildfly-9.0.2.Final






checkWildfly=`find -name ‘wildfly*.tgz’ | wc -l`



WASVER=jboss






if [ “$checkWildfly” -gt 0 ]; then



echo “jboss : $wildfly” >> INSTALL_MESSAGE



WASVER=wildfly



else



echo “jboss : $jboss” >> INSTALL_MESSAGE



fi







#unzip





공간은 적더라도 채움은 만땅으로

Leave a comment

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다