Ubuntuにおけるtomcat起動スクリプトコード

投稿者: | 2017年4月29日

#cd /etc/rc.d/init.d/
#vi tomcat

サンプルコード
#!/bin/sh
#
# tomcat: Start/Stop/Restart tomcat
#
# chkconfig: 2345 80 20
# description: Tomcat is a Java Servlet Container
#
#
# match these values to your environment:
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_TMPDIR=/usr/local/tomcat/temp
export JRE_HOME=/usr/java/jdk15

# Source function library.
. /etc/rc.d/init.d/functions

TOMCAT=/usr/local/tomcat

start() {
echo -n $”Starting Tomcat: ”
$TOMCAT/bin/catalina.sh start
}

stop() {
echo -n $”Stopping Tomcat: ”
$TOMCAT/bin/catalina.sh stop

}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
;;
status)
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart}”
;;
esac
exit $RETVAL

権限を設定
#chmod a+x tomcat
#chkconfig –add tomcat
#chkconfig –list tomcat