# cd /etc/rc.d/init.d
# vi tomcat
以下のスクリプトを記述します。
#!/bin/sh
#
# Startup script for Tomcat, the Apache Servlet Engine
#
# chkconfig: 345 80 20
# description: Tomcat is the Apache Servlet Engine
# processname: tomcat
# pidfile: /var/run/tomcat.pid
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
if [ -f /usr/local/tomcat/bin/catalina.sh ]; then
echo -n "Starting tomcat: "
export JAVA_HOME=/usr/java/j2sdk1.4.2
export LANG=ja_JP.eucJP
daemon --user "nobody" "/usr/local/tomcat/bin/catalina.sh start"
echo
touch /var/lock/subsys/tomcat
fi
;;
stop)
if [ -f /usr/local/tomcat/bin/catalina.sh ]; then
echo -n "Shutting down tomcat: "
daemon --user "nobody" "/usr/local/tomcat/bin/catalina.sh stop"
echo
rm -f /var/lock/subsys/tomcat
rm -f /var/run/tomcat.pid
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
|