- 아파치 ( 수동으로 실행 시 root 계정으로 실행 )
/etc/rc.d/rc.local 파일에 다음 내용을 추가
/usr/local/apache/bin/apachectl start
- 톰캣
/etc/rc.d/init.d/tomcat 이란 파일로 아래 내용 작성
==================================================
#!/bin/sh
# Source function library.
. /etc/rc.d/init.d/functions
source /etc/profile
export tomcat_HOME=톰캣 경로
# See how we were called.
case "$1" in
start)
echo -n "Starting tomcat EXPERIMENTAL: "
daemon $tomcat_HOME/bin/startup.sh
echo
;;
stop)
echo -n "Shutting down tomcat EXPERIMENTAL: "
daemon $tomcat_HOME/bin/shutdown.sh
echo
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
==================================================
# chmod 755 /etc/rc.d/init.d/tomcat 권한 설정
# /etc/rc.d/init.d/tomcat 실행테스트
Usage : {start|stop|restart} 이 메세지가 뜨면 완성
출처: http://www.parkjinsu.com/23 [SomeThing]
==================
좀더 많은 내용
#!/bin/bash## tomcat## chkconfig: 345 96 30# description: Start up the Tomcat servlet engine.## processname: java# pidfile: /var/run/tomcat.pid#### BEGIN INIT INFO# Provides: tomcat# Required-Start: $network $syslog# Required-Stop: $network $syslog# Should-Start: distcache# Short-Description: start and stop Apache HTTP Server# Description: implementation for Servlet 2.5 and JSP 2.1## END INIT INFO# Source function library.. /etc/init.d/functions## tomcat installation directoryPROCESS_NAME=tomcat-servicenameCATALINA_HOME="/home/lesstif/apache-tomcat-7.0.54/"## run as a diffent userTOMCAT_USER=lesstif## Path to the pid, runnning info filepidfile=${PIDFILE-/var/run/${PROCESS_NAME}.pid};lockfile=${LOCKFILE-/var/lock/subsys/${PROCESS_NAME}};RETVAL=0case "$1" in start) PID=`pidofproc -p ${pidfile} ${PROCESS_NAME}` if [[ (-n ${PID}) && ($PID -gt 0) ]]; then logger -s "${PROCESS_NAME}(pid ${PID}) is already running." exit; fi if [ -f $CATALINA_HOME/bin/startup.sh ]; then logger -s "Starting Tomcat" PID=`ps -eaf|grep processname=${PROCESS_NAME}|grep -v grep|awk '{print $2}'` RETVAL=$? [ $RETVAL = 0 ] && touch ${lockfile} [ $RETVAL = 0 ] && echo "${PID}" > ${pidfile} fi ;; stop) PID=`pidofproc -p ${pidfile} ${PROCESS_NAME}` ## if PID valid run shutdown.sh if [[ -z ${PID} ]];then logger -s "${PROCESS_NAME} is not running." exit; fi if [[ (${PID} -gt 0) && (-f $CATALINA_HOME/bin/shutdown.sh) ]]; then logger -s "Stopping Tomcat" RETVAL=$? [ $RETVAL = 0 ] && rm -f ${lockfile} [ $RETVAL = 0 ] && rm -f ${pidfile} fi ;; status) status -p ${pidfile} ${PROCESS_NAME} RETVAL=$? ;; restart) $0 stop $0 start ;;version) if [ -f $CATALINA_HOME/bin/version.sh ]; then logger -s "Display Tomcat Version" RETVAL=$? fi ;; *) echo $"Usage: $0 {start|stop|restart|status|version}" exit 1 ;;esacexit $RETVAL출처 : https://www.lesstif.com/pages/viewpage.action?pageId=6979609
'프로그래밍 > Server / WAS' 카테고리의 다른 글
| Windows Server 2008 R2 특정 URL 불러오는 파일 작성 (0) | 2013.09.09 |
|---|---|
| tomcat 에러페이지 설정 방법 (0) | 2013.08.16 |
| 톰캣 에러페이지 설정 (0) | 2012.08.14 |
| appbase를 이용한 tomcat 설정(docbase 설정) (0) | 2012.08.13 |
| tomcat 에서 한글 깨질시 catalina.bat을 이용한 한글깨짐 방지 (0) | 2012.08.13 |