블로그 이미지
윤영식
Frontend Application Architecter, Full Stacker, KnowHow Dispenser and Bike Rider

Publication

Statistics Graph

Recent Comment

2013.07.18 10:08 Middleware, Cloud/WAS

JBoss 기동후 정상적으로 시작되었는지 확인해 보기위하여 server.log 또는 nohup.out 에서 "Started in" 로그를 체크한다. 하지만 간혹 해당 메세지가 안나올 경우도 있는데 이때는 ADMIN PORT (default: 8080)에 대해서 체크하도록 한다 



1. start, stop, status check shell

#!/bin/sh
#JBOSS start and stop script.
#rks2286(at)gmail(dot)com
#Sample script start and stop for jboss:
#-----------------------
#Changable texts JBOSS_ROOT, ADMIN_USERNAME, ADMIN_PASSWD, ADMIN_PORT, RMI_PORT, PROFILE.
#-----------------------
JBOSS_ROOT=/opt/jboss-eap-4.3/jboss-as/
ADMIN_USERNAME=admin
ADMIN_PASSWD=jbossadm
ADMIN_PORT=8080
RMI_PORT=1099
PROFILE=all
#---------------------
#JBOSS StartUp.....
#---------------------
export CLASSPATH
start() {
echo Starting jboss...;
echo Wait while the jboss server starts...;
$JBOSS_ROOT/bin/run.sh -c $PROFILE -b 0.0.0.0 > /tmp/null &
}
#-------------------
#JBOSS shutdown.....
#-------------------

stop() {
echo Stopping jboss..;
echo Wait while the jboss server stops;
$JBOSS_ROOT/bin/shutdown.sh -s `hostname`:$RMI_PORT -u $ADMIN_USERNAME -p $ADMIN_PASSWD &
}
status() {
echo Checking JBoss Status..
echo Wait for a while...
_up=`netstat -an | grep $ADMIN_PORT | grep -v grep | wc -l`

if [[ "${_up}" != "0" ]]; then
echo "###############################################"
echo "JBoss Application Server is Up!! And Running.!!"
echo "###############################################"
else
echo "##################################"
echo "JBoss Application Server is Down!!"
echo "##################################"
fi;
}

if [[ "${1}" == "start" ]];
then
start
elif [[ "${1}" == "stop" ]];
then
stop
elif [[ "${1}" == "status" ]];
then
status
else
echo "####################################################"
echo Usage:
echo export JBOSS_ROOT=Path_To_Root_Folder
echo .\/\jboss.sh start\|\stop;
echo Example:
echo export JBOSS_ROOT=\/\opt\/\jboss-eap-4.3\/\jboss-as;
echo ./jboss.sh start\|\stop;
echo "####################################################"
fi;
exit 0;


2. 수행 방법 

  - 해당 쉘이 jboss.sh 라면

  - 시작 : jboss.sh start

  - 종료 : jboss.sh stop

  - 정상 : jboss.sh status



<참조>

  - 원문 : start, stop, status shell script

저작자 표시 비영리 변경 금지
신고
posted by peter yun 윤영식
TAG