Можно добавить скрипт запуска сервиса в /etc/init.d/
Делаем:
nano /etc/init.d/tomcat
И прописываем следующее:
#!/bin/bash
#
# Init file for SixSigns Tomcat server
#
# chkconfig: 2345 55 25
# description: SixSigns Tomcat server
#
# Source function library.
. /etc/init.d/functions
RUN_AS_USER=root # Adjust run user here
CATALINA_HOME=/opt/tomcat
start() {
echo "Starting Razuna Tomcat: "
if [ "x$USER" != "x$RUN_AS_USER" ]; then
su - $RUN_AS_USER -c "$CATALINA_HOME/bin/startup.sh"
else
$CATALINA_HOME/bin/startup.sh
fi
echo "done."
}
stop() {
echo "Shutting down Razuna Tomcat: "
if [ "x$USER" != "x$RUN_AS_USER" ]; then
su - $RUN_AS_USER -c "$CATALINA_HOME/bin/shutdown.sh"
else
$CATALINA_HOME/bin/shutdown.sh
fi
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
#echo "Hard killing any remaining threads.."
#kill -9 `cat $CATALINA_HOME/work/catalina.pid`
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
Теперь можно рестортовать сервис /etc/init.d/tomcat stop|start и добавить его в автозапуск chkconfig tomcat on.