1. Save tomcat start / stop script
vi /etc/init.d/tomcat 파일 생성하기
# vi /etc/init.d/tomcat # chkconfig: 345 91 10 # description: Starts and stops the Tomcat daemon. # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 tomcat=/usr/local/jakarta-tomcat startup=$tomcat/bin/startup.sh shutdown=$tomcat/bin/shutdown.sh export JAVA_HOME=/usr/local/jdk start(){ echo -n $"Starting Tomcat service: " #daemon -c $startup RETVAL=$? echo } stop(){ action $"Stopping Tomcat service: " $shutdown RETVAL=$? echo } restart(){ stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) # This doesn't work ;) status tomcat ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esac exit 0
2. chmod +x
root# chmod +x /etc/init.d/tomcat
3. 등록하기
chkconfig --add tomcat
확인
[root@rfid init.d]# chkconfig
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
jexec 0:on 1:on 2:on 3:on 4:on 5:on 6:on
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
postgresql-9.2 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
tomcat 0:off 1:off 2:off 3:on 4:on 5:on 6:off
udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off
[root@rfid init.d]#
'OS > Linux' 카테고리의 다른 글
CentOS port open / RHEL/CentOS 7 방화벽(firewalld) 설정 (0) | 2020.04.27 |
---|---|
Install PostgreSQL on CentOS 6.3 [ 설치 , 백업 , 복구 ] (0) | 2020.04.27 |
Install Webmin on CentOS 6 (0) | 2020.04.27 |
CentOS / DNS server (0) | 2020.04.27 |
CentOS / setup / CentOS min의경우 설치안됨 (0) | 2020.04.26 |