CentOSでのTomcat-8.0.20の自動起動設定方法
#cd /etc/init.d
サンプルコード下記
#vim tomcat8
#!/bin/bash
#
# tomcat startup script for the Tomcat server
#
# chkconfig: 345 80 20
# description: start the tomcat deamon
#
# Source function library
. /etc/rc.d/init.d/functions
prog=tomcat8
JAVA_HOME=/opt/env/jdk1.8.0_40
export JAVA_HOME
CATALANA_HOME=/opt/env/apache-tomcat-8.0.20/
export CATALINA_HOME
case “$1" in
start)
echo “Starting Tomcat…"
$CATALANA_HOME/bin/startup.sh
;;
stop)
echo “Stopping Tomcat…"
$CATALANA_HOME/bin/shutdown.sh
;;
restart)
echo “Stopping Tomcat…"
$CATALANA_HOME/bin/shutdown.sh
sleep 2
echo
echo “Starting Tomcat…"
$CATALANA_HOME/bin/startup.sh
;;
*)
echo “Usage: $prog {start|stop|restart}"
;;
esac
exit 0
:wq!
権限の設定
#chmod 755 tomcat8
tomcat起動
#service tomcat8 start
自動起動
#chkconfig tomcat8 on