이강우 2015/08/03 16:14

tomcat.sh

tomcat.sh
#!/bin/sh
##############################################
# instance    : sample
# description : sample instance environment
# date        : 2015-03-27
# author      : kwlee2@linuxdata.co.kr
# copyright   : Linux Data System co.
#               http://linuxdata.co.kr
##############################################
ABSOLUTE_PATH="$(cd $(dirname "$0") && pwd -P)"
PROFILE_PATH="${ABSOLUTE_PATH%/*}"
DIR_NAME="${PROFILE_PATH##*/}"
 
. $ABSOLUTE_PATH/tomcat.env
 
if [ -z "$SERVER_NAME" ]
then
	echo "WARNING : tomcat.env is not configured."
	echo "WARNING : Program Exit."
	exit 1
fi
 
if [ "$DIR_NAME" != "$SERVER_NAME" ]
then
	echo "WARNING : DIRECTORY and SERVER_NAME are not same"
	echo "WARNING : Program Exit."
	exit 1
fi
 
if [ $TOMCAT_USER != $UNAME ]
then
	echo "WARNING : Current User is [$UNAME]. MUST run to [$TOMCAT_USER]."
	echo "WARNING : Program Exit."
	exit 1
fi
 
case $1 in
    start|run)
	#RESULT=`$CATALINA_HOME/bin/catalina.sh configtest > /dev/null 2>&1`
	RESULT=`$CATALINA_HOME/bin/catalina.sh configtest`
 
	if [ $? -ne 0 ]
	then
	        echo "WARNING : server.xml configuration error. Program Exit."
	        echo "$RESULT"
	        exit 1
	else
	        $CATALINA_HOME/bin/catalina.sh $@
	fi
        ;;
    *)
	$CATALINA_HOME/bin/catalina.sh $@
esac
exit 0
 
# EOF
tomcat.bat
@echo off
REM ##############################################
REM # instance    : sample
REM # description : sample instance environment
REM # date        : 2016-08-02
REM # author      : KangWoo Lee
REM #               kwlee2@linuxdata.co.kr
REM # copyright   : Linux Data System co.
REM #               http:\\linuxdata.co.kr
REM # platform    : WINDOWS / DOS
REM ##############################################
 
set ABSOLUTE_PATH="%~dp0"
set PATH_TOKEN=%ABSOLUTE_PATH:\=;%
set ARG=%1
 
for /F "tokens=* delims=;" %%i IN (%PATH_TOKEN%) DO call :LAST_FOLDER %%i
goto :EOF
 
:LAST_FOLDER
if "%1"=="" (
    @echo %DIR_NAME%
    goto :START_SCRIPT
)
 
SET DIR_NAME=%1
SHIFT
 
goto :LAST_FOLDER
REM =========================================
 
:START_SCRIPT
call %ABSOLUTE_PATH%env.cmd
 
REM ==========================================
echo CATALINA_HOME=%CATALINA_HOME%
echo CATALINA_BASE=%CATALINA_BASE%
echo CATALINA_OPTS=%CATALINA_OPTS%
echo CATALINA_OUT=%CATALINA_OUT%
echo CATALINA_PID=%CATALINA_PID%
echo CATALINA_TMPDIR=%CATALINA_TMPDIR%
echo JAVA_HOME=%JAVA_HOME%
echo JAVA_OPTS=%JAVA_OPTS%
 
if NOT "%DIR_NAME%" == "%SERVER_NAME%" (
	echo DIR_NAME:%DIR_NAME%
	echo SERVER_NAME:%SERVER_NAME%
	echo WARNING : DIRECTORY and SERVER_NAME are not same
	echo WARNING : Program Exit.
	goto :EOF
)
 
call %CATALINA_HOME%\bin\catalina.bat %ARG%
로그인하면 댓글을 남길 수 있습니다.
  • tomcat.sh.txt
  • 마지막으로 수정됨: 2019/05/20 16:10
  • 저자 koov