티스토리 뷰
728x90
출처 : Configure Tomcat service linux
Installing Tomcat as a Linux Service
라즈베리파이(Raspberry Pi) 아파치 톰캣 서버(Tomcat Server) 설치방법 (JSP 서블릿 컨테이너, 자바 웹서버 구축)
sharplet/tomcat-init
tomcat7 설치
$ cd /usr/local $ sudo wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.75/bin/apache-tomcat-7.0.75.tar.gz $ sudo tar -xvf apache-tomcat-7.0.75.tar.gz
tomcat 서비스 등록 - tomcat 파일 생성하기
$ sudo vi /etc/init.d/tomcat
#!/bin/sh # # /etc/init.d/tomcat7 -- startup script for the Tomcat 7 servlet engine # # Written by Miquel van Smoorenburg. # Modified for Debian GNU/Linux by Ian Murdock . # Modified for Tomcat by Stefan Gybas . # Modified for Tomcat6 by Thierry Carrez . # Modified for Tomcat7 by Ernesto Hernandez-Novich . # Additional improvements by Jason Brittain . # ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Should-Start: $named # Should-Stop: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Tomcat. # Description: Start the Tomcat servlet engine. # sudo update-rc.d tomcat defaults # sudo update-rc.d tomcat remove # ls /etc/rc0.d ### END INIT INFO set -e ## Source function library. #. /etc/rc.d/init.d/functions export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt export JAVA_OPTS="-Dfile.encoding=UTF-8 \ -Dcatalina.logbase=/var/log/tomcat7 \ -Dnet.sf.ehcache.skipUpdateCheck=true \ -XX:+DoEscapeAnalysis \ -XX:+UseConcMarkSweepGC \ -XX:+CMSClassUnloadingEnabled \ -XX:+UseParNewGC \ -XX:MaxPermSize=128m \ -Xms512m -Xmx512m" export PATH=$JAVA_HOME/bin:$PATH export TOMCAT_USER=root export TOMCAT_HOME=/usr/local/apache-tomcat-7.0.75 export SHUTDOWN_WAIT=20 tomcat_pid() { echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'` } start() { pid=$(tomcat_pid) if [ -n "$pid" ] then echo "Tomcat is already running (pid: $pid)" else # Start tomcat echo "Starting tomcat" ulimit -n 100000 umask 007 /bin/su - $TOMCAT_USER -c $TOMCAT_HOME/bin/startup.sh fi return 0 } stop() { pid=$(tomcat_pid) if [ -n "$pid" ] then echo "Stoping Tomcat" /bin/su - $TOMCAT_USER -c $TOMCAT_HOME/bin/shutdown.sh let kwait=$SHUTDOWN_WAIT count=0; until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ] do echo -n -e "\nwaiting for processes to exit"; sleep 1 let count=$count+1; done if [ $count -gt $kwait ]; then echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds\n" kill -9 $pid fi else echo "Tomcat is not running" fi return 0 } case $1 in start) start ;; stop) stop ;; restart) stop start ;; status) pid=$(tomcat_pid) if [ -n "$pid" ] then echo "Tomcat is running with pid: $pid" else echo "Tomcat is not running" fi ;; esac exit 0
tomcat 권한설정
$ sudo chmod u+x /etc/init.d/tomcat
tomcat 실행 스크립트 파일 부팅시 자동으로 되도록 복사
$ sudo update-rc.d tomcat defaults
tomcat 서비스 명령으로 실행
$ sudo service tomcat restart
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 송주경
- Linux
- 레이싱모델 익스트림 포토 페스티벌
- BPI-M4
- 전예희
- Xcode
- Delphi Tip
- JavaScript
- ffmpeg
- Java
- 서울오토살롱
- 일본여행
- Spring MVC
- SAS
- 지스타2007
- oracle
- flex
- Delphi
- 동경
- koba2010
- MySQL
- Mac
- Spring
- KOBA
- ubuntu
- NDK
- android
- sas2009
- ble
- 튜닝쇼 2008
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함