diff --git a/shell/tomcat/README.md b/shell/tomcat/README.md new file mode 100644 index 0000000..c0eff95 --- /dev/null +++ b/shell/tomcat/README.md @@ -0,0 +1,43 @@ +# 베포 스크립트 가이드 + +> /application/adds/tomcat에 배포 스크립트를 추가 + +### 0. war 파일 upload + +> /application/adds 에 adds-fo.war 파일을 업로드 + +### 1. application deploy + +> /application/adds/tomcat/webapps/ROOT.war_backup 삭제 +> /application/adds/adds-fo.war -> /application/adds/tomcat/webapps/ROOT.war로 이동 +> tomcat shutdown +> /application/adds/tomcat/webapps/ROOT 폴더 삭제 + +```shell +$ /application/adds/tomcat/deploy.sh +``` + +### 2. application start + +```shell +$ /application/adds/tomcat/start.sh +``` + +### 3. stop + +```shell +$ /application/adds/tomcat/stop.sh +``` + +### shell script 실행시 에러 조치 + +> then ^M .... 에러 발생시 +> window에서 작성된 shell script를 linux에서 실행시 발생하는 에러 +> \r문자가 포함되어 있어서 발생하는 에러 + +```shell +$ dos2unix 파일명.sh + +# dos2unix 설치 +$ sudo yum install dos2unix +``` diff --git a/shell/tomcat/deploy.sh b/shell/tomcat/deploy.sh new file mode 100644 index 0000000..802310f --- /dev/null +++ b/shell/tomcat/deploy.sh @@ -0,0 +1,8 @@ +rm -f /applications/adds/tomcat/webapps/ROOT.war_backup +mv /applications/adds/tomcat/webapps/ROOT.war /applications/adds/tomcat/webapps/ROOT.war_backup +cp /applications/adds/adds-fo.war /applications/adds/tomcat/webapps/ROOT.war +#cp /var/lib/jenkins/workspace/ENS-WEB/build/libs/ROOT.war /applications/ENS-WEB/tomcat/webapps +source /applications/adds/tomcat/tomcat.sh +/usr/local/lib/apache-tomcat-9.0.56/bin/shutdown.sh +rm -rf /applications/adds/tomcat/webapps/ROOT +#/usr/local/lib/apache-tomcat-8.5.73/bin/startup.sh diff --git a/shell/tomcat/start.sh b/shell/tomcat/start.sh new file mode 100644 index 0000000..11c565a --- /dev/null +++ b/shell/tomcat/start.sh @@ -0,0 +1,2 @@ +source /applications/adds/tomcat/tomcat.sh +/usr/local/lib/apache-tomcat-9.0.56/bin/startup.sh $1 $2 diff --git a/shell/tomcat/stop.sh b/shell/tomcat/stop.sh new file mode 100644 index 0000000..505c9e5 --- /dev/null +++ b/shell/tomcat/stop.sh @@ -0,0 +1,2 @@ +source /applications/adds/tomcat/tomcat.sh +/usr/local/lib/apache-tomcat-9.0.56/bin/shutdown.sh diff --git a/shell/tomcat/tomcat.sh b/shell/tomcat/tomcat.sh new file mode 100644 index 0000000..3201c78 --- /dev/null +++ b/shell/tomcat/tomcat.sh @@ -0,0 +1,9 @@ +export JAVA_HOME=/lib/jvm/jdk-17.0.2 +export CATALINA_HOME=/usr/local/lib/apache-tomcat-9.0.56 +export CATALINA_BASE=/applications/adds/tomcat +export CATALINA_TMPDIR=/applications/adds/tomcat/temp +export CATALINA_OUT=/data/adds/logs/adds-fo-tomcat.log +export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/jsp-api.jar:$CATALINA_HOME/lib/servlet-api.jar +export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin +# conf/catalina.properties에서 설정 +#export JAVA_OPTS="-Dspring.profiles.active=dev"