你如何在启动时启动tomcat 7?

时间:2013-10-05 11:09:52

标签: tomcat autostart

我在debian squeeze上运行tomcat 7.0.42。如何设置Tomcat以在启动时启动

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

我认为这是最简单的版本。只需更改Tomcat路径并将其复制到/etc/init.d。

#!/bin/bash

### BEGIN INIT INFO
# Provides:          Apache Tomcat Server
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop:     $network $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Should-Start:      
# Should-Stop:       
# Short-Description: Starts the Tomcat Server.
### END INIT INFO

TOMCAT_HOME=[PATH-TO-TOMCAT-DIR]

case "$1" in
    start)
    echo "Starting Tomcat Server ..." 
    $TOMCAT_HOME/bin/startup.sh
    ;;
stop)
    echo "Stopping Tomcat Server ..."
    $TOMCAT_HOME/bin/shutdown.sh
    ;;
*)
    echo "Usage: /etc/init.d/tomcat {start|stop}"
    exit 1
    ;;
esac
exit 0